From 6698a08ff74e5ef0b08ea18e3ffed046c85bf1ba Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 11 Nov 2025 15:36:58 +0000 Subject: [PATCH] Regenerate client from commit 77956c4 of spec repo --- .generator/schemas/v2/openapi.yaml | 647 +++++++ .../AddRoleToRestrictionQuery.ts | 28 + .../AddRoleToRestrictionQuery_3894482781.ts | 35 + .../CreateRestrictionQuery.ts | 29 + .../DeleteRestrictionQuery.ts | 22 + .../DeleteRestrictionQuery_1369314527.ts | 26 + .../GetRestrictionQuery.ts | 26 + .../GetRoleRestrictionQuery.ts | 25 + .../ListRestrictionQueries.ts | 18 + .../ListRestrictionQueryRoles.ts | 26 + .../ListUserRestrictionQueries.ts | 25 + .../RemoveRoleFromRestrictionQuery.ts | 29 + ...emoveRoleFromRestrictionQuery_950671518.ts | 37 + .../UpdateRestrictionQuery.ts | 34 + features/support/scenarios_model_mapping.ts | 94 ++ features/v2/given.json | 13 + features/v2/logs_restriction_queries.feature | 331 ++++ features/v2/undo.json | 67 + .../configuration.ts | 10 + .../apis/LogsRestrictionQueriesApi.ts | 1482 +++++++++++++++++ packages/datadog-api-client-v2/index.ts | 31 + .../models/LogsRestrictionQueriesType.ts | 16 + .../models/ObjectSerializer.ts | 34 + .../models/RestrictionQueryAttributes.ts | 70 + .../RestrictionQueryCreateAttributes.ts | 52 + .../models/RestrictionQueryCreateData.ts | 62 + .../models/RestrictionQueryCreatePayload.ts | 53 + .../models/RestrictionQueryListResponse.ts | 53 + .../RestrictionQueryResponseIncludedItem.ts | 16 + .../models/RestrictionQueryRole.ts | 69 + .../models/RestrictionQueryRoleAttribute.ts | 52 + .../models/RestrictionQueryRolesResponse.ts | 53 + .../RestrictionQueryUpdateAttributes.ts | 52 + .../models/RestrictionQueryUpdateData.ts | 62 + .../models/RestrictionQueryUpdatePayload.ts | 53 + .../RestrictionQueryWithRelationships.ts | 79 + ...strictionQueryWithRelationshipsResponse.ts | 62 + .../RestrictionQueryWithoutRelationships.ts | 69 + ...ictionQueryWithoutRelationshipsResponse.ts | 53 + 39 files changed, 3995 insertions(+) create mode 100644 examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery.ts create mode 100644 examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery_3894482781.ts create mode 100644 examples/v2/logs-restriction-queries/CreateRestrictionQuery.ts create mode 100644 examples/v2/logs-restriction-queries/DeleteRestrictionQuery.ts create mode 100644 examples/v2/logs-restriction-queries/DeleteRestrictionQuery_1369314527.ts create mode 100644 examples/v2/logs-restriction-queries/GetRestrictionQuery.ts create mode 100644 examples/v2/logs-restriction-queries/GetRoleRestrictionQuery.ts create mode 100644 examples/v2/logs-restriction-queries/ListRestrictionQueries.ts create mode 100644 examples/v2/logs-restriction-queries/ListRestrictionQueryRoles.ts create mode 100644 examples/v2/logs-restriction-queries/ListUserRestrictionQueries.ts create mode 100644 examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery.ts create mode 100644 examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery_950671518.ts create mode 100644 examples/v2/logs-restriction-queries/UpdateRestrictionQuery.ts create mode 100644 features/v2/logs_restriction_queries.feature create mode 100644 packages/datadog-api-client-v2/apis/LogsRestrictionQueriesApi.ts create mode 100644 packages/datadog-api-client-v2/models/LogsRestrictionQueriesType.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryAttributes.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryCreateAttributes.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryCreateData.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryCreatePayload.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryListResponse.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryResponseIncludedItem.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryRole.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryRoleAttribute.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryRolesResponse.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryUpdateAttributes.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryUpdateData.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryUpdatePayload.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryWithRelationships.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryWithRelationshipsResponse.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryWithoutRelationships.ts create mode 100644 packages/datadog-api-client-v2/models/RestrictionQueryWithoutRelationshipsResponse.ts diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d5ef9bfc5d3c..65b90809c2c1 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -945,6 +945,27 @@ components: required: true schema: type: string + RestrictionQueryID: + description: The ID of the restriction query. + in: path + name: restriction_query_id + required: true + schema: + type: string + RestrictionQueryRoleID: + description: The ID of the role. + in: path + name: role_id + required: true + schema: + type: string + RestrictionQueryUserID: + description: The ID of the user. + in: path + name: user_id + required: true + schema: + type: string RetentionFilterIdParam: description: The ID of the retention filter. in: path @@ -30041,6 +30062,15 @@ components: example: eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ== type: string type: object + LogsRestrictionQueriesType: + default: logs_restriction_queries + description: Restriction query resource type. + enum: + - logs_restriction_queries + example: logs_restriction_queries + type: string + x-enum-varnames: + - LOGS_RESTRICTION_QUERIES LogsSort: description: Sort parameters when querying logs. enum: @@ -41362,6 +41392,169 @@ components: required: - data type: object + RestrictionQueryAttributes: + description: Attributes of the restriction query. + properties: + created_at: + description: Creation time of the restriction query. + example: '2020-03-17T21:06:44.000Z' + format: date-time + readOnly: true + type: string + modified_at: + description: Time of last restriction query modification. + example: '2020-03-17T21:15:15.000Z' + format: date-time + readOnly: true + type: string + restriction_query: + description: The query that defines the restriction. Only the content matching + the query can be returned. + example: env:sandbox + type: string + type: object + RestrictionQueryCreateAttributes: + description: Attributes of the created restriction query. + properties: + restriction_query: + description: The restriction query. + example: env:sandbox + type: string + type: object + RestrictionQueryCreateData: + description: Data related to the creation of a restriction query. + properties: + attributes: + $ref: '#/components/schemas/RestrictionQueryCreateAttributes' + type: + $ref: '#/components/schemas/LogsRestrictionQueriesType' + type: object + RestrictionQueryCreatePayload: + description: Create a restriction query. + properties: + data: + $ref: '#/components/schemas/RestrictionQueryCreateData' + type: object + RestrictionQueryListResponse: + description: Response containing information about multiple restriction queries. + properties: + data: + description: Array of returned restriction queries. + items: + $ref: '#/components/schemas/RestrictionQueryWithoutRelationships' + type: array + type: object + RestrictionQueryResponseIncludedItem: + description: An object related to a restriction query. + discriminator: + mapping: + roles: '#/components/schemas/RestrictionQueryRole' + propertyName: type + oneOf: + - $ref: '#/components/schemas/RestrictionQueryRole' + RestrictionQueryRole: + description: Partial role object. + properties: + attributes: + $ref: '#/components/schemas/RestrictionQueryRoleAttribute' + id: + description: ID of the role. + example: + type: string + type: + default: roles + description: Role resource type. + example: roles + readOnly: true + type: string + type: object + RestrictionQueryRoleAttribute: + description: Attributes of the role for a restriction query. + properties: + name: + description: The role name. + example: Datadog Admin Role + type: string + type: object + RestrictionQueryRolesResponse: + description: Response containing information about roles attached to a restriction + query. + properties: + data: + description: Array of roles. + items: + $ref: '#/components/schemas/RestrictionQueryRole' + type: array + type: object + RestrictionQueryUpdateAttributes: + description: Attributes of the edited restriction query. + properties: + restriction_query: + description: The restriction query. + example: env:sandbox + type: string + type: object + RestrictionQueryUpdateData: + description: Data related to the update of a restriction query. + properties: + attributes: + $ref: '#/components/schemas/RestrictionQueryUpdateAttributes' + type: + $ref: '#/components/schemas/LogsRestrictionQueriesType' + type: object + RestrictionQueryUpdatePayload: + description: Update a restriction query. + properties: + data: + $ref: '#/components/schemas/RestrictionQueryUpdateData' + type: object + RestrictionQueryWithRelationships: + description: Restriction query object returned by the API. + properties: + attributes: + $ref: '#/components/schemas/RestrictionQueryAttributes' + id: + description: ID of the restriction query. + example: 79a0e60a-644a-11ea-ad29-43329f7f58b5 + type: string + relationships: + $ref: '#/components/schemas/UserRelationships' + type: + $ref: '#/components/schemas/LogsRestrictionQueriesType' + type: object + RestrictionQueryWithRelationshipsResponse: + description: Response containing information about a single restriction query. + properties: + data: + $ref: '#/components/schemas/RestrictionQueryWithRelationships' + included: + description: Array of objects related to the restriction query. + items: + $ref: '#/components/schemas/RestrictionQueryResponseIncludedItem' + type: array + type: object + RestrictionQueryWithoutRelationships: + description: Restriction query object returned by the API. + properties: + attributes: + $ref: '#/components/schemas/RestrictionQueryAttributes' + id: + description: ID of the restriction query. + example: 79a0e60a-644a-11ea-ad29-43329f7f58b5 + type: string + type: + default: logs_restriction_queries + description: Restriction queries type. + example: logs_restriction_queries + readOnly: true + type: string + type: object + RestrictionQueryWithoutRelationshipsResponse: + description: Response containing information about a single restriction query. + properties: + data: + $ref: '#/components/schemas/RestrictionQueryWithoutRelationships' + type: object RetentionFilter: description: The definition of the retention filter. properties: @@ -69114,6 +69307,422 @@ paths: operator: OR permissions: - logs_generate_metrics + /api/v2/logs/config/restriction_queries: + get: + description: Returns all restriction queries, including their names and IDs. + operationId: ListRestrictionQueries + parameters: + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryListResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List restriction queries + tags: + - Logs Restriction Queries + x-permission: + operator: OR + permissions: + - logs_read_config + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create a new restriction query for your organization. + operationId: CreateRestrictionQuery + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryCreatePayload' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryWithoutRelationshipsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/logs/config/restriction_queries/role/{role_id}: + get: + description: Get restriction query for a given role. + operationId: GetRoleRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryRoleID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryListResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get restriction query for a given role + tags: + - Logs Restriction Queries + x-permission: + operator: OR + permissions: + - logs_read_config + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/logs/config/restriction_queries/user/{user_id}: + get: + description: Get all restriction queries for a given user. + operationId: ListUserRestrictionQueries + parameters: + - $ref: '#/components/parameters/RestrictionQueryUserID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryListResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get all restriction queries for a given user + tags: + - Logs Restriction Queries + x-permission: + operator: OR + permissions: + - logs_read_config + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/logs/config/restriction_queries/{restriction_query_id}: + delete: + description: Deletes a restriction query. + operationId: DeleteRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + responses: + '204': + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Get a restriction query in the organization specified by the restriction + query's `restriction_query_id`. + operationId: GetRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryWithRelationshipsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - logs_read_config + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + patch: + description: Edit a restriction query. + operationId: UpdateRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryUpdatePayload' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryWithoutRelationshipsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/logs/config/restriction_queries/{restriction_query_id}/roles: + delete: + description: Removes a role from a restriction query. + operationId: RemoveRoleFromRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RelationshipToRole' + required: true + responses: + '204': + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Revoke role from a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Returns all roles that have a given restriction query. + operationId: ListRestrictionQueryRoles + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryRolesResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List roles for a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - logs_read_config + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Adds a role to a restriction query. + operationId: AddRoleToRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RelationshipToRole' + required: true + responses: + '204': + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Grant role to a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/logs/events: get: description: 'List endpoint returns logs that match a log search query. @@ -83776,6 +84385,44 @@ tags: description: Find out more at url: https://docs.datadoghq.com/logs/logs_to_metrics/ name: Logs Metrics +- description: '**Note: This endpoint is in public beta. If you have any feedback, + contact [Datadog support](https://docs.datadoghq.com/help/).** + + + A Restriction Query is a logs query that restricts which logs the `logs_read_data` + permission grants read access to. + + For users whose roles have Restriction Queries, any log query they make only returns + those log events that also match + + one of their Restriction Queries. This is true whether the user queries log events + from any log-related feature, including + + the log explorer, Live Tail, re-hydration, or a dashboard widget. + + + Restriction Queries currently only support use of the following components of + log events: + + + - Reserved attributes + + - The log message + + - Tags + + + To restrict read access on log data, add a team tag to log events to indicate + which teams own them, and then scope Restriction Queries to the relevant values + of the team tag. Tags can be applied to log events in many ways, and a log event + can have multiple tags with the same key (like team) and different values. This + means the same log event can be visible to roles whose restriction queries are + scoped to different team values. + + + See [How to Set Up RBAC for Logs](https://docs.datadoghq.com/logs/guide/logs-rbac/?tab=api#restrict-access-to-logs) + for details on how to add restriction queries.' + name: Logs Restriction Queries - description: "The metrics endpoint allows you to:\n\n- Post metrics data so it can be graphed on Datadog\u2019s dashboards\n- Query metrics from any time period (timeseries and scalar)\n- Modify tag configurations for metrics\n- View tags diff --git a/examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery.ts b/examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery.ts new file mode 100644 index 000000000000..a90b1836eb14 --- /dev/null +++ b/examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery.ts @@ -0,0 +1,28 @@ +/** + * Grant role to a restriction query returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.addRoleToRestrictionQuery"] = true; +const apiInstance = new v2.LogsRestrictionQueriesApi(configuration); + +const params: v2.LogsRestrictionQueriesApiAddRoleToRestrictionQueryRequest = { + body: { + data: { + id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", + type: "roles", + }, + }, + restrictionQueryId: "restriction_query_id", +}; + +apiInstance + .addRoleToRestrictionQuery(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery_3894482781.ts b/examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery_3894482781.ts new file mode 100644 index 000000000000..0cf0130e58e1 --- /dev/null +++ b/examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery_3894482781.ts @@ -0,0 +1,35 @@ +/** + * Grant role to a restriction query returns "No Content" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.addRoleToRestrictionQuery"] = true; +const apiInstance = new v2.LogsRestrictionQueriesApi(configuration); + +// there is a valid "restriction_query" in the system +const RESTRICTION_QUERY_DATA_ID = process.env + .RESTRICTION_QUERY_DATA_ID as string; + +// there is a valid "role" in the system +const ROLE_DATA_ID = process.env.ROLE_DATA_ID as string; + +const params: v2.LogsRestrictionQueriesApiAddRoleToRestrictionQueryRequest = { + body: { + data: { + type: "roles", + id: ROLE_DATA_ID, + }, + }, + restrictionQueryId: RESTRICTION_QUERY_DATA_ID, +}; + +apiInstance + .addRoleToRestrictionQuery(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/logs-restriction-queries/CreateRestrictionQuery.ts b/examples/v2/logs-restriction-queries/CreateRestrictionQuery.ts new file mode 100644 index 000000000000..afccf04ad290 --- /dev/null +++ b/examples/v2/logs-restriction-queries/CreateRestrictionQuery.ts @@ -0,0 +1,29 @@ +/** + * Create a restriction query returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.createRestrictionQuery"] = true; +const apiInstance = new v2.LogsRestrictionQueriesApi(configuration); + +const params: v2.LogsRestrictionQueriesApiCreateRestrictionQueryRequest = { + body: { + data: { + type: "logs_restriction_queries", + attributes: { + restrictionQuery: "env:sandbox", + }, + }, + }, +}; + +apiInstance + .createRestrictionQuery(params) + .then((data: v2.RestrictionQueryWithoutRelationshipsResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/logs-restriction-queries/DeleteRestrictionQuery.ts b/examples/v2/logs-restriction-queries/DeleteRestrictionQuery.ts new file mode 100644 index 000000000000..e6d37f7aaf91 --- /dev/null +++ b/examples/v2/logs-restriction-queries/DeleteRestrictionQuery.ts @@ -0,0 +1,22 @@ +/** + * Delete a restriction query returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.deleteRestrictionQuery"] = true; +const apiInstance = new v2.LogsRestrictionQueriesApi(configuration); + +const params: v2.LogsRestrictionQueriesApiDeleteRestrictionQueryRequest = { + restrictionQueryId: "restriction_query_id", +}; + +apiInstance + .deleteRestrictionQuery(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/logs-restriction-queries/DeleteRestrictionQuery_1369314527.ts b/examples/v2/logs-restriction-queries/DeleteRestrictionQuery_1369314527.ts new file mode 100644 index 000000000000..af7797a14bca --- /dev/null +++ b/examples/v2/logs-restriction-queries/DeleteRestrictionQuery_1369314527.ts @@ -0,0 +1,26 @@ +/** + * Delete a restriction query returns "No Content" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.deleteRestrictionQuery"] = true; +const apiInstance = new v2.LogsRestrictionQueriesApi(configuration); + +// there is a valid "restriction_query" in the system +const RESTRICTION_QUERY_DATA_ID = process.env + .RESTRICTION_QUERY_DATA_ID as string; + +const params: v2.LogsRestrictionQueriesApiDeleteRestrictionQueryRequest = { + restrictionQueryId: RESTRICTION_QUERY_DATA_ID, +}; + +apiInstance + .deleteRestrictionQuery(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/logs-restriction-queries/GetRestrictionQuery.ts b/examples/v2/logs-restriction-queries/GetRestrictionQuery.ts new file mode 100644 index 000000000000..bba81970d7ed --- /dev/null +++ b/examples/v2/logs-restriction-queries/GetRestrictionQuery.ts @@ -0,0 +1,26 @@ +/** + * Get a restriction query returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.getRestrictionQuery"] = true; +const apiInstance = new v2.LogsRestrictionQueriesApi(configuration); + +// there is a valid "restriction_query" in the system +const RESTRICTION_QUERY_DATA_ID = process.env + .RESTRICTION_QUERY_DATA_ID as string; + +const params: v2.LogsRestrictionQueriesApiGetRestrictionQueryRequest = { + restrictionQueryId: RESTRICTION_QUERY_DATA_ID, +}; + +apiInstance + .getRestrictionQuery(params) + .then((data: v2.RestrictionQueryWithRelationshipsResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/logs-restriction-queries/GetRoleRestrictionQuery.ts b/examples/v2/logs-restriction-queries/GetRoleRestrictionQuery.ts new file mode 100644 index 000000000000..cba4d42569f4 --- /dev/null +++ b/examples/v2/logs-restriction-queries/GetRoleRestrictionQuery.ts @@ -0,0 +1,25 @@ +/** + * Get restriction query for a given role returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.getRoleRestrictionQuery"] = true; +const apiInstance = new v2.LogsRestrictionQueriesApi(configuration); + +// there is a valid "role" in the system +const ROLE_DATA_ID = process.env.ROLE_DATA_ID as string; + +const params: v2.LogsRestrictionQueriesApiGetRoleRestrictionQueryRequest = { + roleId: ROLE_DATA_ID, +}; + +apiInstance + .getRoleRestrictionQuery(params) + .then((data: v2.RestrictionQueryListResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/logs-restriction-queries/ListRestrictionQueries.ts b/examples/v2/logs-restriction-queries/ListRestrictionQueries.ts new file mode 100644 index 000000000000..3a2e4a7077f0 --- /dev/null +++ b/examples/v2/logs-restriction-queries/ListRestrictionQueries.ts @@ -0,0 +1,18 @@ +/** + * List restriction queries returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.listRestrictionQueries"] = true; +const apiInstance = new v2.LogsRestrictionQueriesApi(configuration); + +apiInstance + .listRestrictionQueries() + .then((data: v2.RestrictionQueryListResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/logs-restriction-queries/ListRestrictionQueryRoles.ts b/examples/v2/logs-restriction-queries/ListRestrictionQueryRoles.ts new file mode 100644 index 000000000000..8aa29a50db81 --- /dev/null +++ b/examples/v2/logs-restriction-queries/ListRestrictionQueryRoles.ts @@ -0,0 +1,26 @@ +/** + * List roles for a restriction query returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.listRestrictionQueryRoles"] = true; +const apiInstance = new v2.LogsRestrictionQueriesApi(configuration); + +// there is a valid "restriction_query" in the system +const RESTRICTION_QUERY_DATA_ID = process.env + .RESTRICTION_QUERY_DATA_ID as string; + +const params: v2.LogsRestrictionQueriesApiListRestrictionQueryRolesRequest = { + restrictionQueryId: RESTRICTION_QUERY_DATA_ID, +}; + +apiInstance + .listRestrictionQueryRoles(params) + .then((data: v2.RestrictionQueryRolesResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/logs-restriction-queries/ListUserRestrictionQueries.ts b/examples/v2/logs-restriction-queries/ListUserRestrictionQueries.ts new file mode 100644 index 000000000000..08f4ff1e0769 --- /dev/null +++ b/examples/v2/logs-restriction-queries/ListUserRestrictionQueries.ts @@ -0,0 +1,25 @@ +/** + * Get all restriction queries for a given user returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.listUserRestrictionQueries"] = true; +const apiInstance = new v2.LogsRestrictionQueriesApi(configuration); + +// there is a valid "user" in the system +const USER_DATA_ID = process.env.USER_DATA_ID as string; + +const params: v2.LogsRestrictionQueriesApiListUserRestrictionQueriesRequest = { + userId: USER_DATA_ID, +}; + +apiInstance + .listUserRestrictionQueries(params) + .then((data: v2.RestrictionQueryListResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery.ts b/examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery.ts new file mode 100644 index 000000000000..6490fab58a29 --- /dev/null +++ b/examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery.ts @@ -0,0 +1,29 @@ +/** + * Revoke role from a restriction query returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.removeRoleFromRestrictionQuery"] = true; +const apiInstance = new v2.LogsRestrictionQueriesApi(configuration); + +const params: v2.LogsRestrictionQueriesApiRemoveRoleFromRestrictionQueryRequest = + { + body: { + data: { + id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", + type: "roles", + }, + }, + restrictionQueryId: "restriction_query_id", + }; + +apiInstance + .removeRoleFromRestrictionQuery(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery_950671518.ts b/examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery_950671518.ts new file mode 100644 index 000000000000..18b3439173e4 --- /dev/null +++ b/examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery_950671518.ts @@ -0,0 +1,37 @@ +/** + * Revoke role from a restriction query returns "No Content" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.addRoleToRestrictionQuery"] = true; +configuration.unstableOperations["v2.removeRoleFromRestrictionQuery"] = true; +const apiInstance = new v2.LogsRestrictionQueriesApi(configuration); + +// there is a valid "restriction_query" in the system +const RESTRICTION_QUERY_DATA_ID = process.env + .RESTRICTION_QUERY_DATA_ID as string; + +// there is a valid "role" in the system +const ROLE_DATA_ID = process.env.ROLE_DATA_ID as string; + +const params: v2.LogsRestrictionQueriesApiRemoveRoleFromRestrictionQueryRequest = + { + body: { + data: { + type: "roles", + id: ROLE_DATA_ID, + }, + }, + restrictionQueryId: RESTRICTION_QUERY_DATA_ID, + }; + +apiInstance + .removeRoleFromRestrictionQuery(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/logs-restriction-queries/UpdateRestrictionQuery.ts b/examples/v2/logs-restriction-queries/UpdateRestrictionQuery.ts new file mode 100644 index 000000000000..aa3b92194c83 --- /dev/null +++ b/examples/v2/logs-restriction-queries/UpdateRestrictionQuery.ts @@ -0,0 +1,34 @@ +/** + * Update a restriction query returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.updateRestrictionQuery"] = true; +const apiInstance = new v2.LogsRestrictionQueriesApi(configuration); + +// there is a valid "restriction_query" in the system +const RESTRICTION_QUERY_DATA_ID = process.env + .RESTRICTION_QUERY_DATA_ID as string; + +const params: v2.LogsRestrictionQueriesApiUpdateRestrictionQueryRequest = { + body: { + data: { + type: "logs_restriction_queries", + attributes: { + restrictionQuery: "env:production", + }, + }, + }, + restrictionQueryId: RESTRICTION_QUERY_DATA_ID, +}; + +apiInstance + .updateRestrictionQuery(params) + .then((data: v2.RestrictionQueryWithoutRelationshipsResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/support/scenarios_model_mapping.ts b/features/support/scenarios_model_mapping.ts index 337479f4de67..8d3a748399ff 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -6667,6 +6667,100 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "LogsMetricResponse", }, + "v2.ListRestrictionQueries": { + "pageSize": { + "type": "number", + "format": "int64", + }, + "pageNumber": { + "type": "number", + "format": "int64", + }, + "operationResponseType": "RestrictionQueryListResponse", + }, + "v2.CreateRestrictionQuery": { + "body": { + "type": "RestrictionQueryCreatePayload", + "format": "", + }, + "operationResponseType": "RestrictionQueryWithoutRelationshipsResponse", + }, + "v2.GetRoleRestrictionQuery": { + "roleId": { + "type": "string", + "format": "", + }, + "operationResponseType": "RestrictionQueryListResponse", + }, + "v2.ListUserRestrictionQueries": { + "userId": { + "type": "string", + "format": "", + }, + "operationResponseType": "RestrictionQueryListResponse", + }, + "v2.GetRestrictionQuery": { + "restrictionQueryId": { + "type": "string", + "format": "", + }, + "operationResponseType": "RestrictionQueryWithRelationshipsResponse", + }, + "v2.DeleteRestrictionQuery": { + "restrictionQueryId": { + "type": "string", + "format": "", + }, + "operationResponseType": "{}", + }, + "v2.UpdateRestrictionQuery": { + "restrictionQueryId": { + "type": "string", + "format": "", + }, + "body": { + "type": "RestrictionQueryUpdatePayload", + "format": "", + }, + "operationResponseType": "RestrictionQueryWithoutRelationshipsResponse", + }, + "v2.ListRestrictionQueryRoles": { + "restrictionQueryId": { + "type": "string", + "format": "", + }, + "pageSize": { + "type": "number", + "format": "int64", + }, + "pageNumber": { + "type": "number", + "format": "int64", + }, + "operationResponseType": "RestrictionQueryRolesResponse", + }, + "v2.AddRoleToRestrictionQuery": { + "restrictionQueryId": { + "type": "string", + "format": "", + }, + "body": { + "type": "RelationshipToRole", + "format": "", + }, + "operationResponseType": "{}", + }, + "v2.RemoveRoleFromRestrictionQuery": { + "restrictionQueryId": { + "type": "string", + "format": "", + }, + "body": { + "type": "RelationshipToRole", + "format": "", + }, + "operationResponseType": "{}", + }, "v2.ListTagConfigurations": { "filterConfigured": { "type": "boolean", diff --git a/features/v2/given.json b/features/v2/given.json index 12852be0f21b..33dd7496dab1 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -651,6 +651,19 @@ "tag": "Logs Metrics", "operationId": "CreateLogsMetric" }, + { + "parameters": [ + { + "name": "body", + "origin": "request", + "value": "{\n \"data\": {\n \"type\": \"logs_restriction_queries\",\n \"attributes\": {\n \"restriction_query\": \"env:staging\"\n }\n }\n}" + } + ], + "step": "there is a valid \"restriction_query\" in the system", + "key": "restriction_query", + "tag": "Logs Restriction Queries", + "operationId": "CreateRestrictionQuery" + }, { "parameters": [ { diff --git a/features/v2/logs_restriction_queries.feature b/features/v2/logs_restriction_queries.feature new file mode 100644 index 000000000000..1833cd276bca --- /dev/null +++ b/features/v2/logs_restriction_queries.feature @@ -0,0 +1,331 @@ +@endpoint(logs-restriction-queries) @endpoint(logs-restriction-queries-v2) +Feature: Logs Restriction Queries + **Note: This endpoint is in public beta. If you have any feedback, contact + [Datadog support](https://docs.datadoghq.com/help/).** A Restriction + Query is a logs query that restricts which logs the `logs_read_data` + permission grants read access to. For users whose roles have Restriction + Queries, any log query they make only returns those log events that also + match one of their Restriction Queries. This is true whether the user + queries log events from any log-related feature, including the log + explorer, Live Tail, re-hydration, or a dashboard widget. Restriction + Queries currently only support use of the following components of log + events: - Reserved attributes - The log message - Tags To restrict read + access on log data, add a team tag to log events to indicate which teams + own them, and then scope Restriction Queries to the relevant values of the + team tag. Tags can be applied to log events in many ways, and a log event + can have multiple tags with the same key (like team) and different values. + This means the same log event can be visible to roles whose restriction + queries are scoped to different team values. See [How to Set Up RBAC for + Logs](https://docs.datadoghq.com/logs/guide/logs-rbac/?tab=api#restrict- + access-to-logs) for details on how to add restriction queries. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "LogsRestrictionQueries" API + + @skip-go @skip-java @skip-python @skip-ruby @skip-rust @skip-terraform-config @skip-typescript @skip-validation @team:DataDog/aaa-granular-access + Scenario: Create a restriction query returns "Bad Request" response + Given new "CreateRestrictionQuery" request + And operation "CreateRestrictionQuery" enabled + And body with value {"test": "bad_request"} + When the request is sent + Then the response status is 400 Bad Request + + @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Create a restriction query returns "OK" response + Given new "CreateRestrictionQuery" request + And operation "CreateRestrictionQuery" enabled + And body with value {"data": {"type": "logs_restriction_queries", "attributes": {"restriction_query": "env:sandbox"}}} + When the request is sent + Then the response status is 200 OK + + @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Delete a restriction query returns "Bad Request" response + Given new "DeleteRestrictionQuery" request + And operation "DeleteRestrictionQuery" enabled + And request contains "restriction_query_id" parameter with value "malformed_id" + When the request is sent + Then the response status is 400 Bad Request + + @skip @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Delete a restriction query returns "No Content" response + Given there is a valid "restriction_query" in the system + And operation "DeleteRestrictionQuery" enabled + And new "DeleteRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + When the request is sent + Then the response status is 204 No Content + + @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Delete a restriction query returns "Not Found" response + Given new "DeleteRestrictionQuery" request + And operation "DeleteRestrictionQuery" enabled + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Delete a restriction query returns "Not found" response + Given operation "DeleteRestrictionQuery" enabled + And new "DeleteRestrictionQuery" request + And request contains "restriction_query_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not found + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Delete a restriction query returns "OK" response + Given operation "DeleteRestrictionQuery" enabled + And new "DeleteRestrictionQuery" request + And request contains "restriction_query_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 OK + + @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Get a restriction query returns "Bad Request" response + Given new "GetRestrictionQuery" request + And operation "GetRestrictionQuery" enabled + And request contains "restriction_query_id" parameter with value "malformed_id" + When the request is sent + Then the response status is 400 Bad Request + + @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Get a restriction query returns "Not Found" response + Given new "GetRestrictionQuery" request + And operation "GetRestrictionQuery" enabled + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Get a restriction query returns "Not found" response + Given operation "GetRestrictionQuery" enabled + And new "GetRestrictionQuery" request + And request contains "restriction_query_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not found + + @skip @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Get a restriction query returns "OK" response + Given there is a valid "restriction_query" in the system + And operation "GetRestrictionQuery" enabled + And new "GetRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" is equal to "{{ restriction_query.data.id }}" + And the response "data.type" is equal to "logs_restriction_queries" + + @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Get all restriction queries for a given user returns "Bad Request" response + Given new "ListUserRestrictionQueries" request + And operation "ListUserRestrictionQueries" enabled + And request contains "user_id" parameter with value "invalid-user-id" + When the request is sent + Then the response status is 400 Bad Request + + @skip @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Get all restriction queries for a given user returns "OK" response + Given there is a valid "user" in the system + And operation "ListUserRestrictionQueries" enabled + And new "ListUserRestrictionQueries" request + And request contains "user_id" parameter from "user.data.id" + When the request is sent + Then the response status is 200 OK + + @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Get restriction query for a given role returns "Bad Request" response + Given new "GetRoleRestrictionQuery" request + And operation "GetRoleRestrictionQuery" enabled + And request contains "role_id" parameter with value "invalid-role-id" + When the request is sent + Then the response status is 400 Bad Request + + @skip @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Get restriction query for a given role returns "OK" response + Given there is a valid "role" in the system + And operation "GetRoleRestrictionQuery" enabled + And new "GetRoleRestrictionQuery" request + And request contains "role_id" parameter from "role.data.id" + When the request is sent + Then the response status is 200 OK + + @skip @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Grant role to a restriction query returns "Bad Request" response + Given there is a valid "restriction_query" in the system + And new "AddRoleToRestrictionQuery" request + And operation "AddRoleToRestrictionQuery" enabled + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + And body with value {"data": {"type": "roles", "id": "invalid-role-id"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Grant role to a restriction query returns "No Content" response + Given there is a valid "restriction_query" in the system + And there is a valid "role" in the system + And operation "AddRoleToRestrictionQuery" enabled + And new "AddRoleToRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + And body with value {"data": {"type": "{{ role.data.type }}", "id": "{{ role.data.id }}"}} + When the request is sent + Then the response status is 204 No Content + + @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Grant role to a restriction query returns "Not Found" response + Given new "AddRoleToRestrictionQuery" request + And operation "AddRoleToRestrictionQuery" enabled + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + And body with value {"data": {"type": "roles", "id": "00000000-0000-0000-0000-000000000001"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Grant role to a restriction query returns "Not found" response + Given operation "AddRoleToRestrictionQuery" enabled + And new "AddRoleToRestrictionQuery" request + And request contains "restriction_query_id" parameter from "REPLACE.ME" + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} + When the request is sent + Then the response status is 404 Not found + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Grant role to a restriction query returns "OK" response + Given operation "AddRoleToRestrictionQuery" enabled + And new "AddRoleToRestrictionQuery" request + And request contains "restriction_query_id" parameter from "REPLACE.ME" + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} + When the request is sent + Then the response status is 204 OK + + @skip @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: List restriction queries returns "OK" response + Given there is a valid "restriction_query" in the system + And operation "ListRestrictionQueries" enabled + And new "ListRestrictionQueries" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: List roles for a restriction query returns "Bad Request" response + Given operation "ListRestrictionQueryRoles" enabled + And new "ListRestrictionQueryRoles" request + And request contains "restriction_query_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: List roles for a restriction query returns "Not Found" response + Given new "ListRestrictionQueryRoles" request + And operation "ListRestrictionQueryRoles" enabled + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: List roles for a restriction query returns "Not found" response + Given operation "ListRestrictionQueryRoles" enabled + And new "ListRestrictionQueryRoles" request + And request contains "restriction_query_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not found + + @skip @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: List roles for a restriction query returns "OK" response + Given there is a valid "restriction_query" in the system + And operation "ListRestrictionQueryRoles" enabled + And new "ListRestrictionQueryRoles" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Revoke role from a restriction query returns "Bad Request" response + Given operation "RemoveRoleFromRestrictionQuery" enabled + And new "RemoveRoleFromRestrictionQuery" request + And request contains "restriction_query_id" parameter from "REPLACE.ME" + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Revoke role from a restriction query returns "No Content" response + Given there is a valid "restriction_query" in the system + And there is a valid "role" in the system + And operation "AddRoleToRestrictionQuery" enabled + And new "AddRoleToRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + And body with value {"data": {"type": "{{ role.data.type }}", "id": "{{ role.data.id }}"}} + And operation "RemoveRoleFromRestrictionQuery" enabled + And new "RemoveRoleFromRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + And body with value {"data": {"type": "{{ role.data.type }}", "id": "{{ role.data.id }}"}} + When the request is sent + And the request is sent + Then the response status is 204 No Content + And the response status is 204 No Content + + @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Revoke role from a restriction query returns "Not Found" response + Given new "RemoveRoleFromRestrictionQuery" request + And operation "RemoveRoleFromRestrictionQuery" enabled + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + And body with value {"data": {"type": "roles", "id": "00000000-0000-0000-0000-000000000001"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Revoke role from a restriction query returns "Not found" response + Given operation "RemoveRoleFromRestrictionQuery" enabled + And new "RemoveRoleFromRestrictionQuery" request + And request contains "restriction_query_id" parameter from "REPLACE.ME" + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} + When the request is sent + Then the response status is 404 Not found + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Revoke role from a restriction query returns "OK" response + Given operation "RemoveRoleFromRestrictionQuery" enabled + And new "RemoveRoleFromRestrictionQuery" request + And request contains "restriction_query_id" parameter from "REPLACE.ME" + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} + When the request is sent + Then the response status is 204 OK + + @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Update a restriction query returns "Bad Request" response + Given new "UpdateRestrictionQuery" request + And operation "UpdateRestrictionQuery" enabled + And request contains "restriction_query_id" parameter with value "malformed_id" + When the request is sent + Then the response status is 400 Bad Request + + @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Update a restriction query returns "Not Found" response + Given new "UpdateRestrictionQuery" request + And operation "UpdateRestrictionQuery" enabled + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + And body with value {"data": {"type": "logs_restriction_queries", "attributes": {"restriction_query": "env:production"}}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Update a restriction query returns "Not found" response + Given operation "UpdateRestrictionQuery" enabled + And new "UpdateRestrictionQuery" request + And request contains "restriction_query_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"restriction_query": "env:sandbox"}, "type": "logs_restriction_queries"}} + When the request is sent + Then the response status is 404 Not found + + @skip @skip-terraform-config @team:DataDog/aaa-granular-access + Scenario: Update a restriction query returns "OK" response + Given there is a valid "restriction_query" in the system + And operation "UpdateRestrictionQuery" enabled + And new "UpdateRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + And body with value {"data": {"type": "logs_restriction_queries", "attributes": {"restriction_query": "env:production"}}} + When the request is sent + Then the response status is 200 OK + And the response "data.id" is equal to "{{ restriction_query.data.id }}" + And the response "data.attributes.restriction_query" is equal to "env:production" diff --git a/features/v2/undo.json b/features/v2/undo.json index cd8c18bf0780..1530d8549de4 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2377,6 +2377,73 @@ "type": "idempotent" } }, + "ListRestrictionQueries": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "safe" + } + }, + "CreateRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "operationId": "DeleteRestrictionQuery", + "parameters": [ + { + "name": "restriction_query_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "GetRoleRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "safe" + } + }, + "ListUserRestrictionQueries": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "safe" + } + }, + "DeleteRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "idempotent" + } + }, + "GetRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "safe" + } + }, + "UpdateRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "idempotent" + } + }, + "RemoveRoleFromRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "idempotent" + } + }, + "ListRestrictionQueryRoles": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "safe" + } + }, + "AddRoleToRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "safe" + } + }, "ListLogsGet": { "tag": "Logs", "undo": { diff --git a/packages/datadog-api-client-common/configuration.ts b/packages/datadog-api-client-common/configuration.ts index 19e45a751aa1..266b553e0ef0 100644 --- a/packages/datadog-api-client-common/configuration.ts +++ b/packages/datadog-api-client-common/configuration.ts @@ -304,6 +304,16 @@ export function createConfiguration( "v2.updateIncidentNotificationTemplate": false, "v2.updateIncidentTodo": false, "v2.updateIncidentType": false, + "v2.addRoleToRestrictionQuery": false, + "v2.createRestrictionQuery": false, + "v2.deleteRestrictionQuery": false, + "v2.getRestrictionQuery": false, + "v2.getRoleRestrictionQuery": false, + "v2.listRestrictionQueries": false, + "v2.listRestrictionQueryRoles": false, + "v2.listUserRestrictionQueries": false, + "v2.removeRoleFromRestrictionQuery": false, + "v2.updateRestrictionQuery": false, "v2.createMonitorUserTemplate": false, "v2.deleteMonitorUserTemplate": false, "v2.getMonitorUserTemplate": false, diff --git a/packages/datadog-api-client-v2/apis/LogsRestrictionQueriesApi.ts b/packages/datadog-api-client-v2/apis/LogsRestrictionQueriesApi.ts new file mode 100644 index 000000000000..0de5bce18fa0 --- /dev/null +++ b/packages/datadog-api-client-v2/apis/LogsRestrictionQueriesApi.ts @@ -0,0 +1,1482 @@ +import { + BaseAPIRequestFactory, + RequiredError, +} from "../../datadog-api-client-common/baseapi"; +import { + Configuration, + applySecurityAuthentication, +} from "../../datadog-api-client-common/configuration"; +import { + RequestContext, + HttpMethod, + ResponseContext, +} from "../../datadog-api-client-common/http/http"; + +import { logger } from "../../../logger"; +import { ObjectSerializer } from "../models/ObjectSerializer"; +import { ApiException } from "../../datadog-api-client-common/exception"; + +import { APIErrorResponse } from "../models/APIErrorResponse"; +import { RelationshipToRole } from "../models/RelationshipToRole"; +import { RestrictionQueryCreatePayload } from "../models/RestrictionQueryCreatePayload"; +import { RestrictionQueryListResponse } from "../models/RestrictionQueryListResponse"; +import { RestrictionQueryRolesResponse } from "../models/RestrictionQueryRolesResponse"; +import { RestrictionQueryUpdatePayload } from "../models/RestrictionQueryUpdatePayload"; +import { RestrictionQueryWithoutRelationshipsResponse } from "../models/RestrictionQueryWithoutRelationshipsResponse"; +import { RestrictionQueryWithRelationshipsResponse } from "../models/RestrictionQueryWithRelationshipsResponse"; + +export class LogsRestrictionQueriesApiRequestFactory extends BaseAPIRequestFactory { + public async addRoleToRestrictionQuery( + restrictionQueryId: string, + body: RelationshipToRole, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'addRoleToRestrictionQuery'"); + if (!_config.unstableOperations["v2.addRoleToRestrictionQuery"]) { + throw new Error( + "Unstable operation 'addRoleToRestrictionQuery' is disabled" + ); + } + + // verify required parameter 'restrictionQueryId' is not null or undefined + if (restrictionQueryId === null || restrictionQueryId === undefined) { + throw new RequiredError( + "restrictionQueryId", + "addRoleToRestrictionQuery" + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "addRoleToRestrictionQuery"); + } + + // Path Params + const localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles".replace( + "{restriction_query_id}", + encodeURIComponent(String(restrictionQueryId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.LogsRestrictionQueriesApi.addRoleToRestrictionQuery") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "RelationshipToRole", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async createRestrictionQuery( + body: RestrictionQueryCreatePayload, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'createRestrictionQuery'"); + if (!_config.unstableOperations["v2.createRestrictionQuery"]) { + throw new Error( + "Unstable operation 'createRestrictionQuery' is disabled" + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createRestrictionQuery"); + } + + // Path Params + const localVarPath = "/api/v2/logs/config/restriction_queries"; + + // Make Request Context + const requestContext = _config + .getServer("v2.LogsRestrictionQueriesApi.createRestrictionQuery") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "RestrictionQueryCreatePayload", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async deleteRestrictionQuery( + restrictionQueryId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'deleteRestrictionQuery'"); + if (!_config.unstableOperations["v2.deleteRestrictionQuery"]) { + throw new Error( + "Unstable operation 'deleteRestrictionQuery' is disabled" + ); + } + + // verify required parameter 'restrictionQueryId' is not null or undefined + if (restrictionQueryId === null || restrictionQueryId === undefined) { + throw new RequiredError("restrictionQueryId", "deleteRestrictionQuery"); + } + + // Path Params + const localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}".replace( + "{restriction_query_id}", + encodeURIComponent(String(restrictionQueryId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.LogsRestrictionQueriesApi.deleteRestrictionQuery") + .makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async getRestrictionQuery( + restrictionQueryId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'getRestrictionQuery'"); + if (!_config.unstableOperations["v2.getRestrictionQuery"]) { + throw new Error("Unstable operation 'getRestrictionQuery' is disabled"); + } + + // verify required parameter 'restrictionQueryId' is not null or undefined + if (restrictionQueryId === null || restrictionQueryId === undefined) { + throw new RequiredError("restrictionQueryId", "getRestrictionQuery"); + } + + // Path Params + const localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}".replace( + "{restriction_query_id}", + encodeURIComponent(String(restrictionQueryId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.LogsRestrictionQueriesApi.getRestrictionQuery") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async getRoleRestrictionQuery( + roleId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'getRoleRestrictionQuery'"); + if (!_config.unstableOperations["v2.getRoleRestrictionQuery"]) { + throw new Error( + "Unstable operation 'getRoleRestrictionQuery' is disabled" + ); + } + + // verify required parameter 'roleId' is not null or undefined + if (roleId === null || roleId === undefined) { + throw new RequiredError("roleId", "getRoleRestrictionQuery"); + } + + // Path Params + const localVarPath = + "/api/v2/logs/config/restriction_queries/role/{role_id}".replace( + "{role_id}", + encodeURIComponent(String(roleId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.LogsRestrictionQueriesApi.getRoleRestrictionQuery") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async listRestrictionQueries( + pageSize?: number, + pageNumber?: number, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'listRestrictionQueries'"); + if (!_config.unstableOperations["v2.listRestrictionQueries"]) { + throw new Error( + "Unstable operation 'listRestrictionQueries' is disabled" + ); + } + + // Path Params + const localVarPath = "/api/v2/logs/config/restriction_queries"; + + // Make Request Context + const requestContext = _config + .getServer("v2.LogsRestrictionQueriesApi.listRestrictionQueries") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Query Params + if (pageSize !== undefined) { + requestContext.setQueryParam( + "page[size]", + ObjectSerializer.serialize(pageSize, "number", "int64"), + "" + ); + } + if (pageNumber !== undefined) { + requestContext.setQueryParam( + "page[number]", + ObjectSerializer.serialize(pageNumber, "number", "int64"), + "" + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async listRestrictionQueryRoles( + restrictionQueryId: string, + pageSize?: number, + pageNumber?: number, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'listRestrictionQueryRoles'"); + if (!_config.unstableOperations["v2.listRestrictionQueryRoles"]) { + throw new Error( + "Unstable operation 'listRestrictionQueryRoles' is disabled" + ); + } + + // verify required parameter 'restrictionQueryId' is not null or undefined + if (restrictionQueryId === null || restrictionQueryId === undefined) { + throw new RequiredError( + "restrictionQueryId", + "listRestrictionQueryRoles" + ); + } + + // Path Params + const localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles".replace( + "{restriction_query_id}", + encodeURIComponent(String(restrictionQueryId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.LogsRestrictionQueriesApi.listRestrictionQueryRoles") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Query Params + if (pageSize !== undefined) { + requestContext.setQueryParam( + "page[size]", + ObjectSerializer.serialize(pageSize, "number", "int64"), + "" + ); + } + if (pageNumber !== undefined) { + requestContext.setQueryParam( + "page[number]", + ObjectSerializer.serialize(pageNumber, "number", "int64"), + "" + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async listUserRestrictionQueries( + userId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'listUserRestrictionQueries'"); + if (!_config.unstableOperations["v2.listUserRestrictionQueries"]) { + throw new Error( + "Unstable operation 'listUserRestrictionQueries' is disabled" + ); + } + + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError("userId", "listUserRestrictionQueries"); + } + + // Path Params + const localVarPath = + "/api/v2/logs/config/restriction_queries/user/{user_id}".replace( + "{user_id}", + encodeURIComponent(String(userId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.LogsRestrictionQueriesApi.listUserRestrictionQueries") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async removeRoleFromRestrictionQuery( + restrictionQueryId: string, + body: RelationshipToRole, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'removeRoleFromRestrictionQuery'"); + if (!_config.unstableOperations["v2.removeRoleFromRestrictionQuery"]) { + throw new Error( + "Unstable operation 'removeRoleFromRestrictionQuery' is disabled" + ); + } + + // verify required parameter 'restrictionQueryId' is not null or undefined + if (restrictionQueryId === null || restrictionQueryId === undefined) { + throw new RequiredError( + "restrictionQueryId", + "removeRoleFromRestrictionQuery" + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "removeRoleFromRestrictionQuery"); + } + + // Path Params + const localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles".replace( + "{restriction_query_id}", + encodeURIComponent(String(restrictionQueryId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.LogsRestrictionQueriesApi.removeRoleFromRestrictionQuery") + .makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "RelationshipToRole", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async updateRestrictionQuery( + restrictionQueryId: string, + body: RestrictionQueryUpdatePayload, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'updateRestrictionQuery'"); + if (!_config.unstableOperations["v2.updateRestrictionQuery"]) { + throw new Error( + "Unstable operation 'updateRestrictionQuery' is disabled" + ); + } + + // verify required parameter 'restrictionQueryId' is not null or undefined + if (restrictionQueryId === null || restrictionQueryId === undefined) { + throw new RequiredError("restrictionQueryId", "updateRestrictionQuery"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "updateRestrictionQuery"); + } + + // Path Params + const localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}".replace( + "{restriction_query_id}", + encodeURIComponent(String(restrictionQueryId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.LogsRestrictionQueriesApi.updateRestrictionQuery") + .makeRequestContext(localVarPath, HttpMethod.PATCH); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "RestrictionQueryUpdatePayload", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } +} + +export class LogsRestrictionQueriesApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to addRoleToRestrictionQuery + * @throws ApiException if the response code was not in [200, 299] + */ + public async addRoleToRestrictionQuery( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 204) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createRestrictionQuery + * @throws ApiException if the response code was not in [200, 299] + */ + public async createRestrictionQuery( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: RestrictionQueryWithoutRelationshipsResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RestrictionQueryWithoutRelationshipsResponse" + ) as RestrictionQueryWithoutRelationshipsResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: RestrictionQueryWithoutRelationshipsResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RestrictionQueryWithoutRelationshipsResponse", + "" + ) as RestrictionQueryWithoutRelationshipsResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteRestrictionQuery + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteRestrictionQuery( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 204) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getRestrictionQuery + * @throws ApiException if the response code was not in [200, 299] + */ + public async getRestrictionQuery( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: RestrictionQueryWithRelationshipsResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RestrictionQueryWithRelationshipsResponse" + ) as RestrictionQueryWithRelationshipsResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: RestrictionQueryWithRelationshipsResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RestrictionQueryWithRelationshipsResponse", + "" + ) as RestrictionQueryWithRelationshipsResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getRoleRestrictionQuery + * @throws ApiException if the response code was not in [200, 299] + */ + public async getRoleRestrictionQuery( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: RestrictionQueryListResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RestrictionQueryListResponse" + ) as RestrictionQueryListResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: RestrictionQueryListResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RestrictionQueryListResponse", + "" + ) as RestrictionQueryListResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listRestrictionQueries + * @throws ApiException if the response code was not in [200, 299] + */ + public async listRestrictionQueries( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: RestrictionQueryListResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RestrictionQueryListResponse" + ) as RestrictionQueryListResponse; + return body; + } + if (response.httpStatusCode === 403 || response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: RestrictionQueryListResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RestrictionQueryListResponse", + "" + ) as RestrictionQueryListResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listRestrictionQueryRoles + * @throws ApiException if the response code was not in [200, 299] + */ + public async listRestrictionQueryRoles( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: RestrictionQueryRolesResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RestrictionQueryRolesResponse" + ) as RestrictionQueryRolesResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: RestrictionQueryRolesResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RestrictionQueryRolesResponse", + "" + ) as RestrictionQueryRolesResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listUserRestrictionQueries + * @throws ApiException if the response code was not in [200, 299] + */ + public async listUserRestrictionQueries( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: RestrictionQueryListResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RestrictionQueryListResponse" + ) as RestrictionQueryListResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: RestrictionQueryListResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RestrictionQueryListResponse", + "" + ) as RestrictionQueryListResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to removeRoleFromRestrictionQuery + * @throws ApiException if the response code was not in [200, 299] + */ + public async removeRoleFromRestrictionQuery( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 204) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updateRestrictionQuery + * @throws ApiException if the response code was not in [200, 299] + */ + public async updateRestrictionQuery( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: RestrictionQueryWithoutRelationshipsResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RestrictionQueryWithoutRelationshipsResponse" + ) as RestrictionQueryWithoutRelationshipsResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: RestrictionQueryWithoutRelationshipsResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "RestrictionQueryWithoutRelationshipsResponse", + "" + ) as RestrictionQueryWithoutRelationshipsResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } +} + +export interface LogsRestrictionQueriesApiAddRoleToRestrictionQueryRequest { + /** + * The ID of the restriction query. + * @type string + */ + restrictionQueryId: string; + /** + * @type RelationshipToRole + */ + body: RelationshipToRole; +} + +export interface LogsRestrictionQueriesApiCreateRestrictionQueryRequest { + /** + * @type RestrictionQueryCreatePayload + */ + body: RestrictionQueryCreatePayload; +} + +export interface LogsRestrictionQueriesApiDeleteRestrictionQueryRequest { + /** + * The ID of the restriction query. + * @type string + */ + restrictionQueryId: string; +} + +export interface LogsRestrictionQueriesApiGetRestrictionQueryRequest { + /** + * The ID of the restriction query. + * @type string + */ + restrictionQueryId: string; +} + +export interface LogsRestrictionQueriesApiGetRoleRestrictionQueryRequest { + /** + * The ID of the role. + * @type string + */ + roleId: string; +} + +export interface LogsRestrictionQueriesApiListRestrictionQueriesRequest { + /** + * Size for a given page. The maximum allowed value is 100. + * @type number + */ + pageSize?: number; + /** + * Specific page number to return. + * @type number + */ + pageNumber?: number; +} + +export interface LogsRestrictionQueriesApiListRestrictionQueryRolesRequest { + /** + * The ID of the restriction query. + * @type string + */ + restrictionQueryId: string; + /** + * Size for a given page. The maximum allowed value is 100. + * @type number + */ + pageSize?: number; + /** + * Specific page number to return. + * @type number + */ + pageNumber?: number; +} + +export interface LogsRestrictionQueriesApiListUserRestrictionQueriesRequest { + /** + * The ID of the user. + * @type string + */ + userId: string; +} + +export interface LogsRestrictionQueriesApiRemoveRoleFromRestrictionQueryRequest { + /** + * The ID of the restriction query. + * @type string + */ + restrictionQueryId: string; + /** + * @type RelationshipToRole + */ + body: RelationshipToRole; +} + +export interface LogsRestrictionQueriesApiUpdateRestrictionQueryRequest { + /** + * The ID of the restriction query. + * @type string + */ + restrictionQueryId: string; + /** + * @type RestrictionQueryUpdatePayload + */ + body: RestrictionQueryUpdatePayload; +} + +export class LogsRestrictionQueriesApi { + private requestFactory: LogsRestrictionQueriesApiRequestFactory; + private responseProcessor: LogsRestrictionQueriesApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: LogsRestrictionQueriesApiRequestFactory, + responseProcessor?: LogsRestrictionQueriesApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = + requestFactory || + new LogsRestrictionQueriesApiRequestFactory(configuration); + this.responseProcessor = + responseProcessor || new LogsRestrictionQueriesApiResponseProcessor(); + } + + /** + * Adds a role to a restriction query. + * @param param The request object + */ + public addRoleToRestrictionQuery( + param: LogsRestrictionQueriesApiAddRoleToRestrictionQueryRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.addRoleToRestrictionQuery( + param.restrictionQueryId, + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.addRoleToRestrictionQuery( + responseContext + ); + }); + }); + } + + /** + * Create a new restriction query for your organization. + * @param param The request object + */ + public createRestrictionQuery( + param: LogsRestrictionQueriesApiCreateRestrictionQueryRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.createRestrictionQuery( + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createRestrictionQuery(responseContext); + }); + }); + } + + /** + * Deletes a restriction query. + * @param param The request object + */ + public deleteRestrictionQuery( + param: LogsRestrictionQueriesApiDeleteRestrictionQueryRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.deleteRestrictionQuery( + param.restrictionQueryId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteRestrictionQuery(responseContext); + }); + }); + } + + /** + * Get a restriction query in the organization specified by the restriction query's `restriction_query_id`. + * @param param The request object + */ + public getRestrictionQuery( + param: LogsRestrictionQueriesApiGetRestrictionQueryRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.getRestrictionQuery( + param.restrictionQueryId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getRestrictionQuery(responseContext); + }); + }); + } + + /** + * Get restriction query for a given role. + * @param param The request object + */ + public getRoleRestrictionQuery( + param: LogsRestrictionQueriesApiGetRoleRestrictionQueryRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.getRoleRestrictionQuery( + param.roleId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getRoleRestrictionQuery( + responseContext + ); + }); + }); + } + + /** + * Returns all restriction queries, including their names and IDs. + * @param param The request object + */ + public listRestrictionQueries( + param: LogsRestrictionQueriesApiListRestrictionQueriesRequest = {}, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.listRestrictionQueries( + param.pageSize, + param.pageNumber, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listRestrictionQueries(responseContext); + }); + }); + } + + /** + * Returns all roles that have a given restriction query. + * @param param The request object + */ + public listRestrictionQueryRoles( + param: LogsRestrictionQueriesApiListRestrictionQueryRolesRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.listRestrictionQueryRoles( + param.restrictionQueryId, + param.pageSize, + param.pageNumber, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listRestrictionQueryRoles( + responseContext + ); + }); + }); + } + + /** + * Get all restriction queries for a given user. + * @param param The request object + */ + public listUserRestrictionQueries( + param: LogsRestrictionQueriesApiListUserRestrictionQueriesRequest, + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.listUserRestrictionQueries(param.userId, options); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listUserRestrictionQueries( + responseContext + ); + }); + }); + } + + /** + * Removes a role from a restriction query. + * @param param The request object + */ + public removeRoleFromRestrictionQuery( + param: LogsRestrictionQueriesApiRemoveRoleFromRestrictionQueryRequest, + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.removeRoleFromRestrictionQuery( + param.restrictionQueryId, + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.removeRoleFromRestrictionQuery( + responseContext + ); + }); + }); + } + + /** + * Edit a restriction query. + * @param param The request object + */ + public updateRestrictionQuery( + param: LogsRestrictionQueriesApiUpdateRestrictionQueryRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.updateRestrictionQuery( + param.restrictionQueryId, + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.updateRestrictionQuery(responseContext); + }); + }); + } +} diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index d8a798bb18fe..53db71348fa2 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -478,6 +478,20 @@ export { LogsMetricsApi, } from "./apis/LogsMetricsApi"; +export { + LogsRestrictionQueriesApiAddRoleToRestrictionQueryRequest, + LogsRestrictionQueriesApiCreateRestrictionQueryRequest, + LogsRestrictionQueriesApiDeleteRestrictionQueryRequest, + LogsRestrictionQueriesApiGetRestrictionQueryRequest, + LogsRestrictionQueriesApiGetRoleRestrictionQueryRequest, + LogsRestrictionQueriesApiListRestrictionQueriesRequest, + LogsRestrictionQueriesApiListRestrictionQueryRolesRequest, + LogsRestrictionQueriesApiListUserRestrictionQueriesRequest, + LogsRestrictionQueriesApiRemoveRoleFromRestrictionQueryRequest, + LogsRestrictionQueriesApiUpdateRestrictionQueryRequest, + LogsRestrictionQueriesApi, +} from "./apis/LogsRestrictionQueriesApi"; + export { MetricsApiCreateBulkTagsMetricsConfigurationRequest, MetricsApiCreateTagConfigurationRequest, @@ -2756,6 +2770,7 @@ export { LogsQueryFilter } from "./models/LogsQueryFilter"; export { LogsQueryOptions } from "./models/LogsQueryOptions"; export { LogsResponseMetadata } from "./models/LogsResponseMetadata"; export { LogsResponseMetadataPage } from "./models/LogsResponseMetadataPage"; +export { LogsRestrictionQueriesType } from "./models/LogsRestrictionQueriesType"; export { LogsSort } from "./models/LogsSort"; export { LogsSortOrder } from "./models/LogsSortOrder"; export { LogsStorageTier } from "./models/LogsStorageTier"; @@ -3472,6 +3487,22 @@ export { RestrictionPolicyBinding } from "./models/RestrictionPolicyBinding"; export { RestrictionPolicyResponse } from "./models/RestrictionPolicyResponse"; export { RestrictionPolicyType } from "./models/RestrictionPolicyType"; export { RestrictionPolicyUpdateRequest } from "./models/RestrictionPolicyUpdateRequest"; +export { RestrictionQueryAttributes } from "./models/RestrictionQueryAttributes"; +export { RestrictionQueryCreateAttributes } from "./models/RestrictionQueryCreateAttributes"; +export { RestrictionQueryCreateData } from "./models/RestrictionQueryCreateData"; +export { RestrictionQueryCreatePayload } from "./models/RestrictionQueryCreatePayload"; +export { RestrictionQueryListResponse } from "./models/RestrictionQueryListResponse"; +export { RestrictionQueryResponseIncludedItem } from "./models/RestrictionQueryResponseIncludedItem"; +export { RestrictionQueryRole } from "./models/RestrictionQueryRole"; +export { RestrictionQueryRoleAttribute } from "./models/RestrictionQueryRoleAttribute"; +export { RestrictionQueryRolesResponse } from "./models/RestrictionQueryRolesResponse"; +export { RestrictionQueryUpdateAttributes } from "./models/RestrictionQueryUpdateAttributes"; +export { RestrictionQueryUpdateData } from "./models/RestrictionQueryUpdateData"; +export { RestrictionQueryUpdatePayload } from "./models/RestrictionQueryUpdatePayload"; +export { RestrictionQueryWithoutRelationships } from "./models/RestrictionQueryWithoutRelationships"; +export { RestrictionQueryWithoutRelationshipsResponse } from "./models/RestrictionQueryWithoutRelationshipsResponse"; +export { RestrictionQueryWithRelationships } from "./models/RestrictionQueryWithRelationships"; +export { RestrictionQueryWithRelationshipsResponse } from "./models/RestrictionQueryWithRelationshipsResponse"; export { RetentionFilter } from "./models/RetentionFilter"; export { RetentionFilterAll } from "./models/RetentionFilterAll"; export { RetentionFilterAllAttributes } from "./models/RetentionFilterAllAttributes"; diff --git a/packages/datadog-api-client-v2/models/LogsRestrictionQueriesType.ts b/packages/datadog-api-client-v2/models/LogsRestrictionQueriesType.ts new file mode 100644 index 000000000000..a0f096c5fc50 --- /dev/null +++ b/packages/datadog-api-client-v2/models/LogsRestrictionQueriesType.ts @@ -0,0 +1,16 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Restriction query resource type. + */ + +export type LogsRestrictionQueriesType = + | typeof LOGS_RESTRICTION_QUERIES + | UnparsedObject; +export const LOGS_RESTRICTION_QUERIES = "logs_restriction_queries"; diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index 5e6e4f75751b..0ac26c2ef4f2 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -1934,6 +1934,21 @@ import { RestrictionPolicyAttributes } from "./RestrictionPolicyAttributes"; import { RestrictionPolicyBinding } from "./RestrictionPolicyBinding"; import { RestrictionPolicyResponse } from "./RestrictionPolicyResponse"; import { RestrictionPolicyUpdateRequest } from "./RestrictionPolicyUpdateRequest"; +import { RestrictionQueryAttributes } from "./RestrictionQueryAttributes"; +import { RestrictionQueryCreateAttributes } from "./RestrictionQueryCreateAttributes"; +import { RestrictionQueryCreateData } from "./RestrictionQueryCreateData"; +import { RestrictionQueryCreatePayload } from "./RestrictionQueryCreatePayload"; +import { RestrictionQueryListResponse } from "./RestrictionQueryListResponse"; +import { RestrictionQueryRole } from "./RestrictionQueryRole"; +import { RestrictionQueryRoleAttribute } from "./RestrictionQueryRoleAttribute"; +import { RestrictionQueryRolesResponse } from "./RestrictionQueryRolesResponse"; +import { RestrictionQueryUpdateAttributes } from "./RestrictionQueryUpdateAttributes"; +import { RestrictionQueryUpdateData } from "./RestrictionQueryUpdateData"; +import { RestrictionQueryUpdatePayload } from "./RestrictionQueryUpdatePayload"; +import { RestrictionQueryWithRelationships } from "./RestrictionQueryWithRelationships"; +import { RestrictionQueryWithRelationshipsResponse } from "./RestrictionQueryWithRelationshipsResponse"; +import { RestrictionQueryWithoutRelationships } from "./RestrictionQueryWithoutRelationships"; +import { RestrictionQueryWithoutRelationshipsResponse } from "./RestrictionQueryWithoutRelationshipsResponse"; import { RetentionFilter } from "./RetentionFilter"; import { RetentionFilterAll } from "./RetentionFilterAll"; import { RetentionFilterAllAttributes } from "./RetentionFilterAllAttributes"; @@ -3350,6 +3365,7 @@ const enumsMap: { [key: string]: any[] } = { LogsMetricComputeAggregationType: ["count", "distribution"], LogsMetricResponseComputeAggregationType: ["count", "distribution"], LogsMetricType: ["logs_metrics"], + LogsRestrictionQueriesType: ["logs_restriction_queries"], LogsSort: ["timestamp", "-timestamp"], LogsSortOrder: ["asc", "desc"], LogsStorageTier: ["indexes", "online-archives", "flex"], @@ -6540,6 +6556,23 @@ const typeMap: { [index: string]: any } = { RestrictionPolicyBinding: RestrictionPolicyBinding, RestrictionPolicyResponse: RestrictionPolicyResponse, RestrictionPolicyUpdateRequest: RestrictionPolicyUpdateRequest, + RestrictionQueryAttributes: RestrictionQueryAttributes, + RestrictionQueryCreateAttributes: RestrictionQueryCreateAttributes, + RestrictionQueryCreateData: RestrictionQueryCreateData, + RestrictionQueryCreatePayload: RestrictionQueryCreatePayload, + RestrictionQueryListResponse: RestrictionQueryListResponse, + RestrictionQueryRole: RestrictionQueryRole, + RestrictionQueryRoleAttribute: RestrictionQueryRoleAttribute, + RestrictionQueryRolesResponse: RestrictionQueryRolesResponse, + RestrictionQueryUpdateAttributes: RestrictionQueryUpdateAttributes, + RestrictionQueryUpdateData: RestrictionQueryUpdateData, + RestrictionQueryUpdatePayload: RestrictionQueryUpdatePayload, + RestrictionQueryWithRelationships: RestrictionQueryWithRelationships, + RestrictionQueryWithRelationshipsResponse: + RestrictionQueryWithRelationshipsResponse, + RestrictionQueryWithoutRelationships: RestrictionQueryWithoutRelationships, + RestrictionQueryWithoutRelationshipsResponse: + RestrictionQueryWithoutRelationshipsResponse, RetentionFilter: RetentionFilter, RetentionFilterAll: RetentionFilterAll, RetentionFilterAllAttributes: RetentionFilterAllAttributes, @@ -7724,6 +7757,7 @@ const oneOfMap: { [index: string]: string[] } = { ], RUMGroupByMissing: ["string", "number"], RUMGroupByTotal: ["boolean", "string", "number"], + RestrictionQueryResponseIncludedItem: ["RestrictionQueryRole"], RoutingRuleAction: ["SendSlackMessageAction", "SendTeamsMessageAction"], ScalarColumn: ["GroupScalarColumn", "DataScalarColumn"], ScalarQuery: ["MetricsScalarQuery", "EventsScalarQuery"], diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryAttributes.ts b/packages/datadog-api-client-v2/models/RestrictionQueryAttributes.ts new file mode 100644 index 000000000000..743947b27dbc --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryAttributes.ts @@ -0,0 +1,70 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes of the restriction query. + */ +export class RestrictionQueryAttributes { + /** + * Creation time of the restriction query. + */ + "createdAt"?: Date; + /** + * Time of last restriction query modification. + */ + "modifiedAt"?: Date; + /** + * The query that defines the restriction. Only the content matching the query can be returned. + */ + "restrictionQuery"?: string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + createdAt: { + baseName: "created_at", + type: "Date", + format: "date-time", + }, + modifiedAt: { + baseName: "modified_at", + type: "Date", + format: "date-time", + }, + restrictionQuery: { + baseName: "restriction_query", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryCreateAttributes.ts b/packages/datadog-api-client-v2/models/RestrictionQueryCreateAttributes.ts new file mode 100644 index 000000000000..ba4c37ed9a12 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryCreateAttributes.ts @@ -0,0 +1,52 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes of the created restriction query. + */ +export class RestrictionQueryCreateAttributes { + /** + * The restriction query. + */ + "restrictionQuery"?: string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + restrictionQuery: { + baseName: "restriction_query", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryCreateAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryCreateData.ts b/packages/datadog-api-client-v2/models/RestrictionQueryCreateData.ts new file mode 100644 index 000000000000..fcebc569e4cf --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryCreateData.ts @@ -0,0 +1,62 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { LogsRestrictionQueriesType } from "./LogsRestrictionQueriesType"; +import { RestrictionQueryCreateAttributes } from "./RestrictionQueryCreateAttributes"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Data related to the creation of a restriction query. + */ +export class RestrictionQueryCreateData { + /** + * Attributes of the created restriction query. + */ + "attributes"?: RestrictionQueryCreateAttributes; + /** + * Restriction query resource type. + */ + "type"?: LogsRestrictionQueriesType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RestrictionQueryCreateAttributes", + }, + type: { + baseName: "type", + type: "LogsRestrictionQueriesType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryCreateData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryCreatePayload.ts b/packages/datadog-api-client-v2/models/RestrictionQueryCreatePayload.ts new file mode 100644 index 000000000000..57fdc194ac5d --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryCreatePayload.ts @@ -0,0 +1,53 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { RestrictionQueryCreateData } from "./RestrictionQueryCreateData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Create a restriction query. + */ +export class RestrictionQueryCreatePayload { + /** + * Data related to the creation of a restriction query. + */ + "data"?: RestrictionQueryCreateData; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "RestrictionQueryCreateData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryCreatePayload.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryListResponse.ts b/packages/datadog-api-client-v2/models/RestrictionQueryListResponse.ts new file mode 100644 index 000000000000..43c3359a770d --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryListResponse.ts @@ -0,0 +1,53 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { RestrictionQueryWithoutRelationships } from "./RestrictionQueryWithoutRelationships"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Response containing information about multiple restriction queries. + */ +export class RestrictionQueryListResponse { + /** + * Array of returned restriction queries. + */ + "data"?: Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryListResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryResponseIncludedItem.ts b/packages/datadog-api-client-v2/models/RestrictionQueryResponseIncludedItem.ts new file mode 100644 index 000000000000..4241a1ad6dcf --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryResponseIncludedItem.ts @@ -0,0 +1,16 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { RestrictionQueryRole } from "./RestrictionQueryRole"; + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * An object related to a restriction query. + */ + +export type RestrictionQueryResponseIncludedItem = + | RestrictionQueryRole + | UnparsedObject; diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryRole.ts b/packages/datadog-api-client-v2/models/RestrictionQueryRole.ts new file mode 100644 index 000000000000..bcb120887f9a --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryRole.ts @@ -0,0 +1,69 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { RestrictionQueryRoleAttribute } from "./RestrictionQueryRoleAttribute"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Partial role object. + */ +export class RestrictionQueryRole { + /** + * Attributes of the role for a restriction query. + */ + "attributes"?: RestrictionQueryRoleAttribute; + /** + * ID of the role. + */ + "id"?: string; + /** + * Role resource type. + */ + "type"?: string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RestrictionQueryRoleAttribute", + }, + id: { + baseName: "id", + type: "string", + }, + type: { + baseName: "type", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryRole.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryRoleAttribute.ts b/packages/datadog-api-client-v2/models/RestrictionQueryRoleAttribute.ts new file mode 100644 index 000000000000..7c5e418aef54 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryRoleAttribute.ts @@ -0,0 +1,52 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes of the role for a restriction query. + */ +export class RestrictionQueryRoleAttribute { + /** + * The role name. + */ + "name"?: string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + name: { + baseName: "name", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryRoleAttribute.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryRolesResponse.ts b/packages/datadog-api-client-v2/models/RestrictionQueryRolesResponse.ts new file mode 100644 index 000000000000..f3b56104c247 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryRolesResponse.ts @@ -0,0 +1,53 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { RestrictionQueryRole } from "./RestrictionQueryRole"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Response containing information about roles attached to a restriction query. + */ +export class RestrictionQueryRolesResponse { + /** + * Array of roles. + */ + "data"?: Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryRolesResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryUpdateAttributes.ts b/packages/datadog-api-client-v2/models/RestrictionQueryUpdateAttributes.ts new file mode 100644 index 000000000000..0f9600b71dfd --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryUpdateAttributes.ts @@ -0,0 +1,52 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes of the edited restriction query. + */ +export class RestrictionQueryUpdateAttributes { + /** + * The restriction query. + */ + "restrictionQuery"?: string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + restrictionQuery: { + baseName: "restriction_query", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryUpdateAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryUpdateData.ts b/packages/datadog-api-client-v2/models/RestrictionQueryUpdateData.ts new file mode 100644 index 000000000000..bed0081139d8 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryUpdateData.ts @@ -0,0 +1,62 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { LogsRestrictionQueriesType } from "./LogsRestrictionQueriesType"; +import { RestrictionQueryUpdateAttributes } from "./RestrictionQueryUpdateAttributes"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Data related to the update of a restriction query. + */ +export class RestrictionQueryUpdateData { + /** + * Attributes of the edited restriction query. + */ + "attributes"?: RestrictionQueryUpdateAttributes; + /** + * Restriction query resource type. + */ + "type"?: LogsRestrictionQueriesType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RestrictionQueryUpdateAttributes", + }, + type: { + baseName: "type", + type: "LogsRestrictionQueriesType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryUpdateData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryUpdatePayload.ts b/packages/datadog-api-client-v2/models/RestrictionQueryUpdatePayload.ts new file mode 100644 index 000000000000..be0d40aefa7d --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryUpdatePayload.ts @@ -0,0 +1,53 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { RestrictionQueryUpdateData } from "./RestrictionQueryUpdateData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Update a restriction query. + */ +export class RestrictionQueryUpdatePayload { + /** + * Data related to the update of a restriction query. + */ + "data"?: RestrictionQueryUpdateData; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "RestrictionQueryUpdateData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryUpdatePayload.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryWithRelationships.ts b/packages/datadog-api-client-v2/models/RestrictionQueryWithRelationships.ts new file mode 100644 index 000000000000..ca1f6f759df7 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryWithRelationships.ts @@ -0,0 +1,79 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { LogsRestrictionQueriesType } from "./LogsRestrictionQueriesType"; +import { RestrictionQueryAttributes } from "./RestrictionQueryAttributes"; +import { UserRelationships } from "./UserRelationships"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Restriction query object returned by the API. + */ +export class RestrictionQueryWithRelationships { + /** + * Attributes of the restriction query. + */ + "attributes"?: RestrictionQueryAttributes; + /** + * ID of the restriction query. + */ + "id"?: string; + /** + * Relationships of the user object. + */ + "relationships"?: UserRelationships; + /** + * Restriction query resource type. + */ + "type"?: LogsRestrictionQueriesType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RestrictionQueryAttributes", + }, + id: { + baseName: "id", + type: "string", + }, + relationships: { + baseName: "relationships", + type: "UserRelationships", + }, + type: { + baseName: "type", + type: "LogsRestrictionQueriesType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryWithRelationships.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryWithRelationshipsResponse.ts b/packages/datadog-api-client-v2/models/RestrictionQueryWithRelationshipsResponse.ts new file mode 100644 index 000000000000..b34b32588668 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryWithRelationshipsResponse.ts @@ -0,0 +1,62 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { RestrictionQueryResponseIncludedItem } from "./RestrictionQueryResponseIncludedItem"; +import { RestrictionQueryWithRelationships } from "./RestrictionQueryWithRelationships"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Response containing information about a single restriction query. + */ +export class RestrictionQueryWithRelationshipsResponse { + /** + * Restriction query object returned by the API. + */ + "data"?: RestrictionQueryWithRelationships; + /** + * Array of objects related to the restriction query. + */ + "included"?: Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "RestrictionQueryWithRelationships", + }, + included: { + baseName: "included", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryWithRelationshipsResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryWithoutRelationships.ts b/packages/datadog-api-client-v2/models/RestrictionQueryWithoutRelationships.ts new file mode 100644 index 000000000000..e176f018b89d --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryWithoutRelationships.ts @@ -0,0 +1,69 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { RestrictionQueryAttributes } from "./RestrictionQueryAttributes"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Restriction query object returned by the API. + */ +export class RestrictionQueryWithoutRelationships { + /** + * Attributes of the restriction query. + */ + "attributes"?: RestrictionQueryAttributes; + /** + * ID of the restriction query. + */ + "id"?: string; + /** + * Restriction queries type. + */ + "type"?: string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RestrictionQueryAttributes", + }, + id: { + baseName: "id", + type: "string", + }, + type: { + baseName: "type", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryWithoutRelationships.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RestrictionQueryWithoutRelationshipsResponse.ts b/packages/datadog-api-client-v2/models/RestrictionQueryWithoutRelationshipsResponse.ts new file mode 100644 index 000000000000..5a47caf6a906 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RestrictionQueryWithoutRelationshipsResponse.ts @@ -0,0 +1,53 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { RestrictionQueryWithoutRelationships } from "./RestrictionQueryWithoutRelationships"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Response containing information about a single restriction query. + */ +export class RestrictionQueryWithoutRelationshipsResponse { + /** + * Restriction query object returned by the API. + */ + "data"?: RestrictionQueryWithoutRelationships; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "RestrictionQueryWithoutRelationships", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RestrictionQueryWithoutRelationshipsResponse.attributeTypeMap; + } + + public constructor() {} +}