From 6182c48b526427586bcb0dab91b8434e4a810b57 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 27 Nov 2025 10:03:16 +0000 Subject: [PATCH] Regenerate client from commit f1a395c of spec repo --- .generator/schemas/v2/openapi.yaml | 734 +++++++++++++++ ...-query-returns-Bad-Request-response.frozen | 1 + ...ion-query-returns-Bad-Request-response.yml | 25 + ...striction-query-returns-OK-response.frozen | 1 + ...-restriction-query-returns-OK-response.yml | 44 + ...-query-returns-Bad-Request-response.frozen | 1 + ...ion-query-returns-Bad-Request-response.yml | 20 + ...on-query-returns-Not-found-response.frozen | 1 + ...ction-query-returns-Not-found-response.yml | 20 + ...striction-query-returns-OK-response.frozen | 1 + ...-restriction-query-returns-OK-response.yml | 62 ++ ...-query-returns-Bad-Request-response.frozen | 1 + ...ion-query-returns-Bad-Request-response.yml | 20 + ...on-query-returns-Not-found-response.frozen | 1 + ...ction-query-returns-Not-found-response.yml | 20 + ...striction-query-returns-OK-response.frozen | 1 + ...-restriction-query-returns-OK-response.yml | 64 ++ ...n-user-returns-Bad-Request-response.frozen | 1 + ...iven-user-returns-Bad-Request-response.yml | 20 + ...ven-user-returns-Not-found-response.frozen | 1 + ...-given-user-returns-Not-found-response.yml | 21 + ...n-role-returns-Bad-Request-response.frozen | 1 + ...iven-role-returns-Bad-Request-response.yml | 20 + ...ven-role-returns-Not-found-response.frozen | 1 + ...-given-role-returns-Not-found-response.yml | 20 + ...or-a-given-role-returns-OK-response.frozen | 1 + ...y-for-a-given-role-returns-OK-response.yml | 60 ++ ...-query-returns-Bad-Request-response.frozen | 1 + ...ion-query-returns-Bad-Request-response.yml | 25 + ...on-query-returns-Not-found-response.frozen | 1 + ...ction-query-returns-Not-found-response.yml | 25 + ...striction-query-returns-OK-response.frozen | 1 + ...-restriction-query-returns-OK-response.yml | 104 +++ ...riction-queries-returns-OK-response.frozen | 1 + ...estriction-queries-returns-OK-response.yml | 22 + ...-query-returns-Bad-Request-response.frozen | 1 + ...ion-query-returns-Bad-Request-response.yml | 20 + ...on-query-returns-Not-found-response.frozen | 1 + ...ction-query-returns-Not-found-response.yml | 20 + ...striction-query-returns-OK-response.frozen | 1 + ...-restriction-query-returns-OK-response.yml | 64 ++ .../AddRoleToRestrictionQuery.rb | 21 + .../CreateRestrictionQuery.rb | 17 + .../DeleteRestrictionQuery.rb | 11 + .../GetRestrictionQuery.rb | 11 + .../GetRoleRestrictionQuery.rb | 11 + .../ListRestrictionQueries.rb | 8 + .../ListRestrictionQueryRoles.rb | 11 + .../ListUserRestrictionQueries.rb | 11 + .../RemoveRoleFromRestrictionQuery.rb | 21 + .../ReplaceRestrictionQuery.rb | 20 + .../UpdateRestrictionQuery.rb | 20 + features/scenarios_model_mapping.rb | 40 + features/v2/given.json | 12 + features/v2/logs_restriction_queries.feature | 287 ++++++ features/v2/undo.json | 73 ++ lib/datadog_api_client/configuration.rb | 11 + lib/datadog_api_client/inflector.rb | 18 + .../v2/api/logs_restriction_queries_api.rb | 842 ++++++++++++++++++ .../models/logs_restriction_queries_type.rb | 26 + .../v2/models/restriction_query_attributes.rb | 165 ++++ .../restriction_query_create_attributes.rb | 123 +++ .../models/restriction_query_create_data.rb | 115 +++ .../restriction_query_create_payload.rb | 105 +++ .../models/restriction_query_list_response.rb | 107 +++ ...estriction_query_response_included_item.rb | 62 ++ .../v2/models/restriction_query_role.rb | 165 ++++ .../restriction_query_role_attribute.rb | 105 +++ .../restriction_query_roles_response.rb | 107 +++ .../restriction_query_update_attributes.rb | 123 +++ .../models/restriction_query_update_data.rb | 115 +++ .../restriction_query_update_payload.rb | 105 +++ .../restriction_query_with_relationships.rb | 135 +++ ...ction_query_with_relationships_response.rb | 117 +++ ...restriction_query_without_relationships.rb | 125 +++ ...on_query_without_relationships_response.rb | 105 +++ 76 files changed, 4800 insertions(+) create mode 100644 cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-OK-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-OK-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Not-found-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Not-found-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-OK-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-OK-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Not-found-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Not-found-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-OK-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-OK-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Not-found-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Not-found-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Not-found-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Not-found-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-OK-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-OK-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Not-found-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Not-found-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-OK-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-OK-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/List-restriction-queries-returns-OK-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/List-restriction-queries-returns-OK-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Not-found-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Not-found-response.yml create mode 100644 cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-OK-response.frozen create mode 100644 cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-OK-response.yml create mode 100644 examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery.rb create mode 100644 examples/v2/logs-restriction-queries/CreateRestrictionQuery.rb create mode 100644 examples/v2/logs-restriction-queries/DeleteRestrictionQuery.rb create mode 100644 examples/v2/logs-restriction-queries/GetRestrictionQuery.rb create mode 100644 examples/v2/logs-restriction-queries/GetRoleRestrictionQuery.rb create mode 100644 examples/v2/logs-restriction-queries/ListRestrictionQueries.rb create mode 100644 examples/v2/logs-restriction-queries/ListRestrictionQueryRoles.rb create mode 100644 examples/v2/logs-restriction-queries/ListUserRestrictionQueries.rb create mode 100644 examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery.rb create mode 100644 examples/v2/logs-restriction-queries/ReplaceRestrictionQuery.rb create mode 100644 examples/v2/logs-restriction-queries/UpdateRestrictionQuery.rb create mode 100644 features/v2/logs_restriction_queries.feature create mode 100644 lib/datadog_api_client/v2/api/logs_restriction_queries_api.rb create mode 100644 lib/datadog_api_client/v2/models/logs_restriction_queries_type.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_create_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_create_data.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_create_payload.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_list_response.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_response_included_item.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_role.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_role_attribute.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_roles_response.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_update_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_update_data.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_update_payload.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_with_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_with_relationships_response.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_without_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/restriction_query_without_relationships_response.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9bceb715496a..be2fed88a24e 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 @@ -30501,6 +30522,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: @@ -41838,6 +41868,191 @@ 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 + last_modifier_email: + description: Email of the user who last modified this restriction query. + example: user@example.com + readOnly: true + type: string + last_modifier_name: + description: Name of the user who last modified this restriction query. + example: John Doe + 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 + role_count: + description: Number of roles associated with this restriction query. + example: 3 + format: int64 + readOnly: true + type: integer + user_count: + description: Number of users associated with this restriction query. + example: 5 + format: int64 + readOnly: true + type: integer + type: object + RestrictionQueryCreateAttributes: + description: Attributes of the created restriction query. + properties: + restriction_query: + description: The restriction query. + example: env:sandbox + type: string + required: + - restriction_query + 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. + 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: + $ref: '#/components/schemas/RolesType' + required: + - type + - id + - attributes + 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 + required: + - restriction_query + 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: @@ -70264,6 +70479,487 @@ 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 + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '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 + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '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/).' + put: + description: Replace a restriction query. + operationId: ReplaceRestrictionQuery + 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: Replace 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. + + + **Note**: This operation automatically grants the `logs_read_data` permission + to the role if it doesn''t already have it.' + 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. @@ -85210,6 +85906,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/cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-Bad-Request-response.frozen b/cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..46f704ffe2a2 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:04.509Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-Bad-Request-response.yml b/cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..2ffc87023095 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-Bad-Request-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:04 GMT + request: + body: + encoding: UTF-8 + string: '{"test":"bad_request"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries + response: + body: + encoding: UTF-8 + string: '{"errors":["API input validation failed: {''_schema'': [{''detail'': + ''Object must include `data` key.'', ''source'': {''pointer'': ''/''}}]}"]}' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-OK-response.frozen b/cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-OK-response.frozen new file mode 100644 index 000000000000..e7d3eb34c15f --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:05.128Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-OK-response.yml b/cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-OK-response.yml new file mode 100644 index 000000000000..745170798dfa --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Create-a-restriction-query-returns-OK-response.yml @@ -0,0 +1,44 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:05 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"restriction_query":"env:sandbox"},"type":"logs_restriction_queries"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"logs_restriction_queries","id":"2b5594f8-c4b3-11f0-a05d-da7ad0900002","attributes":{"restriction_query":"env:sandbox","created_at":"2025-11-18T19:17:05.370176+00:00","modified_at":"2025-11-18T19:17:05.370176+00:00"}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Tue, 18 Nov 2025 19:17:05 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2b5594f8-c4b3-11f0-a05d-da7ad0900002 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Bad-Request-response.frozen b/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..606a5c297d19 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:06.402Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Bad-Request-response.yml b/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..337de4a80fac --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Bad-Request-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:06 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/malformed_id + response: + body: + encoding: UTF-8 + string: '{"errors":["uuid is not proper type"]}' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Not-found-response.frozen b/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Not-found-response.frozen new file mode 100644 index 000000000000..b407dce9fcaf --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Not-found-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:06.567Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Not-found-response.yml b/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Not-found-response.yml new file mode 100644 index 000000000000..339559fb720e --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-Not-found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:06 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/00000000-0000-0000-0000-000000000000 + response: + body: + encoding: UTF-8 + string: '{"errors":["Restriction query not found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-OK-response.frozen b/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-OK-response.frozen new file mode 100644 index 000000000000..233ffaffa5cc --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:06.720Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-OK-response.yml b/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-OK-response.yml new file mode 100644 index 000000000000..6eceaea84d0a --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Delete-a-restriction-query-returns-OK-response.yml @@ -0,0 +1,62 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:06 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"restriction_query":"env:sandbox"},"type":"logs_restriction_queries"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"logs_restriction_queries","id":"2c373dc2-c4b3-11f0-8ca7-da7ad0900002","attributes":{"restriction_query":"env:sandbox","created_at":"2025-11-18T19:17:06.848316+00:00","modified_at":"2025-11-18T19:17:06.848316+00:00"}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Tue, 18 Nov 2025 19:17:06 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2c373dc2-c4b3-11f0-8ca7-da7ad0900002 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +- recorded_at: Tue, 18 Nov 2025 19:17:06 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2c373dc2-c4b3-11f0-8ca7-da7ad0900002 + response: + body: + encoding: UTF-8 + string: '{"errors":["Restriction query not found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Bad-Request-response.frozen b/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..35466be50386 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:07.277Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Bad-Request-response.yml b/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..d3e1f1d5a41c --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Bad-Request-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:07 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/malformed_id + response: + body: + encoding: UTF-8 + string: '{"errors":["uuid is not proper type"]}' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Not-found-response.frozen b/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Not-found-response.frozen new file mode 100644 index 000000000000..27aff0c3f076 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Not-found-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:07.461Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Not-found-response.yml b/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Not-found-response.yml new file mode 100644 index 000000000000..afffb41feeb7 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-Not-found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:07 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/00000000-0000-0000-0000-000000000000 + response: + body: + encoding: UTF-8 + string: '{"errors":["Restriction query not found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-OK-response.frozen b/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-OK-response.frozen new file mode 100644 index 000000000000..1f267748178e --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:07.622Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-OK-response.yml b/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-OK-response.yml new file mode 100644 index 000000000000..54b5c2e0f4e0 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-a-restriction-query-returns-OK-response.yml @@ -0,0 +1,64 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:07 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"restriction_query":"env:sandbox"},"type":"logs_restriction_queries"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"logs_restriction_queries","id":"2cc39998-c4b3-11f0-8b4b-da7ad0900002","attributes":{"restriction_query":"env:sandbox","created_at":"2025-11-18T19:17:07.768188+00:00","modified_at":"2025-11-18T19:17:07.768188+00:00"}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Tue, 18 Nov 2025 19:17:07 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2cc39998-c4b3-11f0-8b4b-da7ad0900002 + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"logs_restriction_queries","id":"2cc39998-c4b3-11f0-8b4b-da7ad0900002","attributes":{"restriction_query":"env:sandbox","created_at":"2025-11-18T19:17:07.768188+00:00","modified_at":"2025-11-18T19:17:07.768188+00:00"},"relationships":{"roles":{"data":[]}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Tue, 18 Nov 2025 19:17:07 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2cc39998-c4b3-11f0-8b4b-da7ad0900002 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Bad-Request-response.frozen b/cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..57b32bd89043 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:08.172Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Bad-Request-response.yml b/cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..4f5493cb4063 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Bad-Request-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:08 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/user/malformed_id + response: + body: + encoding: UTF-8 + string: '{"errors":["uuid is not proper type"]}' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Not-found-response.frozen b/cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Not-found-response.frozen new file mode 100644 index 000000000000..9ee4a5d52067 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Not-found-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:08.336Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Not-found-response.yml b/cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Not-found-response.yml new file mode 100644 index 000000000000..bacb25d17911 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-all-restriction-queries-for-a-given-user-returns-Not-found-response.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:08 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/user/00000000-0000-0000-0000-000000000000 + response: + body: + encoding: UTF-8 + string: '{"errors":["user with uuid 00000000-0000-0000-0000-000000000000 doesn''t + exist"]}' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Bad-Request-response.frozen b/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..57897532acf1 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:08.604Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Bad-Request-response.yml b/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..c9ce040de2e6 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Bad-Request-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:08 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/role/malformed_id + response: + body: + encoding: UTF-8 + string: '{"errors":["Missing Role malformed_id"]}' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Not-found-response.frozen b/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Not-found-response.frozen new file mode 100644 index 000000000000..bd0df2da885a --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Not-found-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:08.828Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Not-found-response.yml b/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Not-found-response.yml new file mode 100644 index 000000000000..225822aeef68 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-Not-found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:08 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/role/00000000-0000-0000-0000-000000000000 + response: + body: + encoding: UTF-8 + string: '{"errors":["Missing Role 00000000-0000-0000-0000-000000000000"]}' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-OK-response.frozen b/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-OK-response.frozen new file mode 100644 index 000000000000..8dc9f697b0c1 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:08.994Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-OK-response.yml b/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-OK-response.yml new file mode 100644 index 000000000000..2c2111715e36 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Get-restriction-query-for-a-given-role-returns-OK-response.yml @@ -0,0 +1,60 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:08 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"name":"Test-Get_restriction_query_for_a_given_role_returns_OK_response-1763493428"},"type":"roles"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/roles + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"2d925300-c4b3-11f0-a252-da7ad0900002","type":"roles","attributes":{"created_at":"2025-11-18T19:17:09.12367Z","modified_at":"2025-11-18T19:17:09.123777Z","name":"Test-Get_restriction_query_for_a_given_role_returns_OK_response-1763493428","team_count":0,"user_count":0},"relationships":{"permissions":{"data":[{"id":"d90f6830-d3d8-11e9-a77a-b3404e5e9ee2","type":"permissions"},{"id":"4441648c-d8b1-11e9-a77a-1b899a04b304","type":"permissions"},{"id":"417ba636-2dce-11eb-84c0-6bce5b0d9de0","type":"permissions"},{"id":"12efc20e-d36c-11eb-a9b8-da7ad0900002","type":"permissions"},{"id":"7605ef24-f376-11eb-b90b-da7ad0900002","type":"permissions"},{"id":"b6bf9ac6-9a59-11ec-8480-da7ad0900002","type":"permissions"},{"id":"f8e941cf-e746-11ec-b22d-da7ad0900002","type":"permissions"},{"id":"6c5ad874-7aff-11ed-a5cd-da7ad0900002","type":"permissions"},{"id":"a8b4d6e8-4ea4-11ee-b482-da7ad0900002","type":"permissions"},{"id":"50c270de-69ee-11ee-9151-da7ad0900002","type":"permissions"}]}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 18 Nov 2025 19:17:08 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/role/2d925300-c4b3-11f0-a252-da7ad0900002 + response: + body: + encoding: UTF-8 + string: '{"data":[]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Tue, 18 Nov 2025 19:17:08 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/roles/2d925300-c4b3-11f0-a252-da7ad0900002 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Bad-Request-response.frozen b/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..48cf494a95d9 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:09.440Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Bad-Request-response.yml b/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..60f54ceaf24f --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Bad-Request-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:09 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"id":"3653d3c6-0c75-11ea-ad28-fb5701eabc7d","type":"roles"}}' + headers: + Accept: + - '*/*' + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/malformed_id/roles + response: + body: + encoding: UTF-8 + string: '{"errors":["Role with id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d not + found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Not-found-response.frozen b/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Not-found-response.frozen new file mode 100644 index 000000000000..f281a86a45c1 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Not-found-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:09.623Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Not-found-response.yml b/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Not-found-response.yml new file mode 100644 index 000000000000..9b13129cb754 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-Not-found-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:09 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"id":"3653d3c6-0c75-11ea-ad28-fb5701eabc7d","type":"roles"}}' + headers: + Accept: + - '*/*' + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/00000000-0000-0000-0000-000000000000/roles + response: + body: + encoding: UTF-8 + string: '{"errors":["Role with id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d not + found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-OK-response.frozen b/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-OK-response.frozen new file mode 100644 index 000000000000..ac88614fb58e --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:09.783Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-OK-response.yml b/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-OK-response.yml new file mode 100644 index 000000000000..696541cec297 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/Grant-role-to-a-restriction-query-returns-OK-response.yml @@ -0,0 +1,104 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:09 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"restriction_query":"env:sandbox"},"type":"logs_restriction_queries"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"logs_restriction_queries","id":"2e0a0abc-c4b3-11f0-9b1d-da7ad0900002","attributes":{"restriction_query":"env:sandbox","created_at":"2025-11-18T19:17:09.907646+00:00","modified_at":"2025-11-18T19:17:09.907646+00:00"}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Tue, 18 Nov 2025 19:17:09 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"name":"Test-Grant_role_to_a_restriction_query_returns_OK_response-1763493429"},"type":"roles"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/roles + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"2e209fb6-c4b3-11f0-8483-da7ad0900002","type":"roles","attributes":{"created_at":"2025-11-18T19:17:10.056015Z","modified_at":"2025-11-18T19:17:10.056318Z","name":"Test-Grant_role_to_a_restriction_query_returns_OK_response-1763493429","team_count":0,"user_count":0},"relationships":{"permissions":{"data":[{"id":"d90f6830-d3d8-11e9-a77a-b3404e5e9ee2","type":"permissions"},{"id":"4441648c-d8b1-11e9-a77a-1b899a04b304","type":"permissions"},{"id":"417ba636-2dce-11eb-84c0-6bce5b0d9de0","type":"permissions"},{"id":"12efc20e-d36c-11eb-a9b8-da7ad0900002","type":"permissions"},{"id":"7605ef24-f376-11eb-b90b-da7ad0900002","type":"permissions"},{"id":"b6bf9ac6-9a59-11ec-8480-da7ad0900002","type":"permissions"},{"id":"f8e941cf-e746-11ec-b22d-da7ad0900002","type":"permissions"},{"id":"6c5ad874-7aff-11ed-a5cd-da7ad0900002","type":"permissions"},{"id":"a8b4d6e8-4ea4-11ee-b482-da7ad0900002","type":"permissions"},{"id":"50c270de-69ee-11ee-9151-da7ad0900002","type":"permissions"}]}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 18 Nov 2025 19:17:09 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"id":"2e209fb6-c4b3-11f0-8483-da7ad0900002","type":"roles"}}' + headers: + Accept: + - '*/*' + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2e0a0abc-c4b3-11f0-9b1d-da7ad0900002/roles + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +- recorded_at: Tue, 18 Nov 2025 19:17:09 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/roles/2e209fb6-c4b3-11f0-8483-da7ad0900002 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Tue, 18 Nov 2025 19:17:09 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2e0a0abc-c4b3-11f0-9b1d-da7ad0900002 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/List-restriction-queries-returns-OK-response.frozen b/cassettes/features/v2/logs_restriction_queries/List-restriction-queries-returns-OK-response.frozen new file mode 100644 index 000000000000..d227ca557fac --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/List-restriction-queries-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:10.912Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/List-restriction-queries-returns-OK-response.yml b/cassettes/features/v2/logs_restriction_queries/List-restriction-queries-returns-OK-response.yml new file mode 100644 index 000000000000..b2fcc4607744 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/List-restriction-queries-returns-OK-response.yml @@ -0,0 +1,22 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:10 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries + response: + body: + encoding: UTF-8 + string: '{"data":[{"type":"logs_restriction_queries","id":"6358d012-be7e-11f0-8999-da7ad0900002","attributes":{"restriction_query":"env:production","created_at":"2025-11-10T21:44:09.039708+00:00","modified_at":"2025-11-10T21:44:09.164487+00:00"}}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Bad-Request-response.frozen b/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..0badf8611124 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:11.052Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Bad-Request-response.yml b/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..61537acbc2b0 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Bad-Request-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:11 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/malformed_id/roles + response: + body: + encoding: UTF-8 + string: '{"errors":["uuid is not proper type"]}' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Not-found-response.frozen b/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Not-found-response.frozen new file mode 100644 index 000000000000..358663320c35 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Not-found-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:11.231Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Not-found-response.yml b/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Not-found-response.yml new file mode 100644 index 000000000000..2e2b755593f8 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-Not-found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:11 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/00000000-0000-0000-0000-000000000000/roles + response: + body: + encoding: UTF-8 + string: '{"errors":["Restriction query not found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-OK-response.frozen b/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-OK-response.frozen new file mode 100644 index 000000000000..5e8d0cb60e01 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-11-18T19:17:11.376Z \ No newline at end of file diff --git a/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-OK-response.yml b/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-OK-response.yml new file mode 100644 index 000000000000..f18e6889e719 --- /dev/null +++ b/cassettes/features/v2/logs_restriction_queries/List-roles-for-a-restriction-query-returns-OK-response.yml @@ -0,0 +1,64 @@ +http_interactions: +- recorded_at: Tue, 18 Nov 2025 19:17:11 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"restriction_query":"env:sandbox"},"type":"logs_restriction_queries"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"logs_restriction_queries","id":"2efc1406-c4b3-11f0-a6d9-da7ad0900002","attributes":{"restriction_query":"env:sandbox","created_at":"2025-11-18T19:17:11.492694+00:00","modified_at":"2025-11-18T19:17:11.492694+00:00"}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Tue, 18 Nov 2025 19:17:11 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2efc1406-c4b3-11f0-a6d9-da7ad0900002/roles + response: + body: + encoding: UTF-8 + string: '{"data":[]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Tue, 18 Nov 2025 19:17:11 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2efc1406-c4b3-11f0-a6d9-da7ad0900002 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery.rb b/examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery.rb new file mode 100644 index 000000000000..fd873f8bc4ae --- /dev/null +++ b/examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery.rb @@ -0,0 +1,21 @@ +# Grant role to a restriction query returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.add_role_to_restriction_query".to_sym] = true +end +api_instance = DatadogAPIClient::V2::LogsRestrictionQueriesAPI.new + +# there is a valid "restriction_query" in the system +RESTRICTION_QUERY_DATA_ID = ENV["RESTRICTION_QUERY_DATA_ID"] + +# there is a valid "role" in the system +ROLE_DATA_ID = ENV["ROLE_DATA_ID"] + +body = DatadogAPIClient::V2::RelationshipToRole.new({ + data: DatadogAPIClient::V2::RelationshipToRoleData.new({ + id: ROLE_DATA_ID, + type: DatadogAPIClient::V2::RolesType::ROLES, + }), +}) +api_instance.add_role_to_restriction_query(RESTRICTION_QUERY_DATA_ID, body) diff --git a/examples/v2/logs-restriction-queries/CreateRestrictionQuery.rb b/examples/v2/logs-restriction-queries/CreateRestrictionQuery.rb new file mode 100644 index 000000000000..aaeb09d88703 --- /dev/null +++ b/examples/v2/logs-restriction-queries/CreateRestrictionQuery.rb @@ -0,0 +1,17 @@ +# Create a restriction query returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_restriction_query".to_sym] = true +end +api_instance = DatadogAPIClient::V2::LogsRestrictionQueriesAPI.new + +body = DatadogAPIClient::V2::RestrictionQueryCreatePayload.new({ + data: DatadogAPIClient::V2::RestrictionQueryCreateData.new({ + attributes: DatadogAPIClient::V2::RestrictionQueryCreateAttributes.new({ + restriction_query: "env:sandbox", + }), + type: DatadogAPIClient::V2::LogsRestrictionQueriesType::LOGS_RESTRICTION_QUERIES, + }), +}) +p api_instance.create_restriction_query(body) diff --git a/examples/v2/logs-restriction-queries/DeleteRestrictionQuery.rb b/examples/v2/logs-restriction-queries/DeleteRestrictionQuery.rb new file mode 100644 index 000000000000..0d0c2be194c5 --- /dev/null +++ b/examples/v2/logs-restriction-queries/DeleteRestrictionQuery.rb @@ -0,0 +1,11 @@ +# Delete a restriction query returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_restriction_query".to_sym] = true +end +api_instance = DatadogAPIClient::V2::LogsRestrictionQueriesAPI.new + +# there is a valid "restriction_query" in the system +RESTRICTION_QUERY_DATA_ID = ENV["RESTRICTION_QUERY_DATA_ID"] +api_instance.delete_restriction_query(RESTRICTION_QUERY_DATA_ID) diff --git a/examples/v2/logs-restriction-queries/GetRestrictionQuery.rb b/examples/v2/logs-restriction-queries/GetRestrictionQuery.rb new file mode 100644 index 000000000000..94c9aad0e580 --- /dev/null +++ b/examples/v2/logs-restriction-queries/GetRestrictionQuery.rb @@ -0,0 +1,11 @@ +# Get a restriction query returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_restriction_query".to_sym] = true +end +api_instance = DatadogAPIClient::V2::LogsRestrictionQueriesAPI.new + +# there is a valid "restriction_query" in the system +RESTRICTION_QUERY_DATA_ID = ENV["RESTRICTION_QUERY_DATA_ID"] +p api_instance.get_restriction_query(RESTRICTION_QUERY_DATA_ID) diff --git a/examples/v2/logs-restriction-queries/GetRoleRestrictionQuery.rb b/examples/v2/logs-restriction-queries/GetRoleRestrictionQuery.rb new file mode 100644 index 000000000000..229012a9f1d2 --- /dev/null +++ b/examples/v2/logs-restriction-queries/GetRoleRestrictionQuery.rb @@ -0,0 +1,11 @@ +# Get restriction query for a given role returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_role_restriction_query".to_sym] = true +end +api_instance = DatadogAPIClient::V2::LogsRestrictionQueriesAPI.new + +# there is a valid "role" in the system +ROLE_DATA_ID = ENV["ROLE_DATA_ID"] +p api_instance.get_role_restriction_query(ROLE_DATA_ID) diff --git a/examples/v2/logs-restriction-queries/ListRestrictionQueries.rb b/examples/v2/logs-restriction-queries/ListRestrictionQueries.rb new file mode 100644 index 000000000000..8fd35d278bfd --- /dev/null +++ b/examples/v2/logs-restriction-queries/ListRestrictionQueries.rb @@ -0,0 +1,8 @@ +# List restriction queries returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_restriction_queries".to_sym] = true +end +api_instance = DatadogAPIClient::V2::LogsRestrictionQueriesAPI.new +p api_instance.list_restriction_queries() diff --git a/examples/v2/logs-restriction-queries/ListRestrictionQueryRoles.rb b/examples/v2/logs-restriction-queries/ListRestrictionQueryRoles.rb new file mode 100644 index 000000000000..0f7a67337df4 --- /dev/null +++ b/examples/v2/logs-restriction-queries/ListRestrictionQueryRoles.rb @@ -0,0 +1,11 @@ +# List roles for a restriction query returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_restriction_query_roles".to_sym] = true +end +api_instance = DatadogAPIClient::V2::LogsRestrictionQueriesAPI.new + +# there is a valid "restriction_query" in the system +RESTRICTION_QUERY_DATA_ID = ENV["RESTRICTION_QUERY_DATA_ID"] +p api_instance.list_restriction_query_roles(RESTRICTION_QUERY_DATA_ID) diff --git a/examples/v2/logs-restriction-queries/ListUserRestrictionQueries.rb b/examples/v2/logs-restriction-queries/ListUserRestrictionQueries.rb new file mode 100644 index 000000000000..4137e9ab0182 --- /dev/null +++ b/examples/v2/logs-restriction-queries/ListUserRestrictionQueries.rb @@ -0,0 +1,11 @@ +# Get all restriction queries for a given user returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_user_restriction_queries".to_sym] = true +end +api_instance = DatadogAPIClient::V2::LogsRestrictionQueriesAPI.new + +# there is a valid "user" in the system +USER_DATA_ID = ENV["USER_DATA_ID"] +p api_instance.list_user_restriction_queries(USER_DATA_ID) diff --git a/examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery.rb b/examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery.rb new file mode 100644 index 000000000000..956a5bf1b798 --- /dev/null +++ b/examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery.rb @@ -0,0 +1,21 @@ +# Revoke role from a restriction query returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.remove_role_from_restriction_query".to_sym] = true +end +api_instance = DatadogAPIClient::V2::LogsRestrictionQueriesAPI.new + +# there is a valid "restriction_query" in the system +RESTRICTION_QUERY_DATA_ID = ENV["RESTRICTION_QUERY_DATA_ID"] + +# there is a valid "role" in the system +ROLE_DATA_ID = ENV["ROLE_DATA_ID"] + +body = DatadogAPIClient::V2::RelationshipToRole.new({ + data: DatadogAPIClient::V2::RelationshipToRoleData.new({ + id: ROLE_DATA_ID, + type: DatadogAPIClient::V2::RolesType::ROLES, + }), +}) +api_instance.remove_role_from_restriction_query(RESTRICTION_QUERY_DATA_ID, body) diff --git a/examples/v2/logs-restriction-queries/ReplaceRestrictionQuery.rb b/examples/v2/logs-restriction-queries/ReplaceRestrictionQuery.rb new file mode 100644 index 000000000000..39ae74837e64 --- /dev/null +++ b/examples/v2/logs-restriction-queries/ReplaceRestrictionQuery.rb @@ -0,0 +1,20 @@ +# Replace a restriction query returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.replace_restriction_query".to_sym] = true +end +api_instance = DatadogAPIClient::V2::LogsRestrictionQueriesAPI.new + +# there is a valid "restriction_query" in the system +RESTRICTION_QUERY_DATA_ID = ENV["RESTRICTION_QUERY_DATA_ID"] + +body = DatadogAPIClient::V2::RestrictionQueryUpdatePayload.new({ + data: DatadogAPIClient::V2::RestrictionQueryUpdateData.new({ + attributes: DatadogAPIClient::V2::RestrictionQueryUpdateAttributes.new({ + restriction_query: "env:staging", + }), + type: DatadogAPIClient::V2::LogsRestrictionQueriesType::LOGS_RESTRICTION_QUERIES, + }), +}) +p api_instance.replace_restriction_query(RESTRICTION_QUERY_DATA_ID, body) diff --git a/examples/v2/logs-restriction-queries/UpdateRestrictionQuery.rb b/examples/v2/logs-restriction-queries/UpdateRestrictionQuery.rb new file mode 100644 index 000000000000..41e204920c26 --- /dev/null +++ b/examples/v2/logs-restriction-queries/UpdateRestrictionQuery.rb @@ -0,0 +1,20 @@ +# Update a restriction query returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_restriction_query".to_sym] = true +end +api_instance = DatadogAPIClient::V2::LogsRestrictionQueriesAPI.new + +# there is a valid "restriction_query" in the system +RESTRICTION_QUERY_DATA_ID = ENV["RESTRICTION_QUERY_DATA_ID"] + +body = DatadogAPIClient::V2::RestrictionQueryUpdatePayload.new({ + data: DatadogAPIClient::V2::RestrictionQueryUpdateData.new({ + attributes: DatadogAPIClient::V2::RestrictionQueryUpdateAttributes.new({ + restriction_query: "env:production", + }), + type: DatadogAPIClient::V2::LogsRestrictionQueriesType::LOGS_RESTRICTION_QUERIES, + }), +}) +p api_instance.update_restriction_query(RESTRICTION_QUERY_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 15e1897d6c51..bd12bef18e99 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2380,6 +2380,46 @@ "metric_id" => "String", "body" => "LogsMetricUpdateRequest", }, + "v2.ListRestrictionQueries" => { + "page_size" => "Integer", + "page_number" => "Integer", + }, + "v2.CreateRestrictionQuery" => { + "body" => "RestrictionQueryCreatePayload", + }, + "v2.GetRoleRestrictionQuery" => { + "role_id" => "String", + }, + "v2.ListUserRestrictionQueries" => { + "user_id" => "String", + }, + "v2.DeleteRestrictionQuery" => { + "restriction_query_id" => "String", + }, + "v2.GetRestrictionQuery" => { + "restriction_query_id" => "String", + }, + "v2.UpdateRestrictionQuery" => { + "restriction_query_id" => "String", + "body" => "RestrictionQueryUpdatePayload", + }, + "v2.ReplaceRestrictionQuery" => { + "restriction_query_id" => "String", + "body" => "RestrictionQueryUpdatePayload", + }, + "v2.RemoveRoleFromRestrictionQuery" => { + "restriction_query_id" => "String", + "body" => "RelationshipToRole", + }, + "v2.ListRestrictionQueryRoles" => { + "restriction_query_id" => "String", + "page_size" => "Integer", + "page_number" => "Integer", + }, + "v2.AddRoleToRestrictionQuery" => { + "restriction_query_id" => "String", + "body" => "RelationshipToRole", + }, "v2.ListTagConfigurations" => { "filter_configured" => "Boolean", "filter_tags_configured" => "String", diff --git a/features/v2/given.json b/features/v2/given.json index 198c7af1b51d..ac2e142e0197 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -679,6 +679,18 @@ "tag": "Logs Metrics", "operationId": "CreateLogsMetric" }, + { + "parameters": [ + { + "name": "body", + "value": "{\"data\": {\"attributes\": {\"restriction_query\": \"env:sandbox\"}, \"type\": \"logs_restriction_queries\"}}" + } + ], + "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..44d65b92fd5c --- /dev/null +++ b/features/v2/logs_restriction_queries.feature @@ -0,0 +1,287 @@ +@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/logs-app + Scenario: Create a restriction query returns "Bad Request" response + Given operation "CreateRestrictionQuery" enabled + And new "CreateRestrictionQuery" request + And body with value {"test": "bad_request"} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/logs-app + Scenario: Create a restriction query returns "OK" response + Given operation "CreateRestrictionQuery" enabled + And new "CreateRestrictionQuery" request + And body with value {"data": {"attributes": {"restriction_query": "env:sandbox"}, "type": "logs_restriction_queries"}} + When the request is sent + Then the response status is 200 OK + + @skip-terraform-config @team:DataDog/logs-app + Scenario: Delete a restriction query returns "Bad Request" response + Given operation "DeleteRestrictionQuery" enabled + And new "DeleteRestrictionQuery" request + 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/logs-app + Scenario: Delete a restriction query returns "Not found" response + Given operation "DeleteRestrictionQuery" enabled + And new "DeleteRestrictionQuery" request + 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 + + @team:DataDog/logs-app + Scenario: Delete a restriction query returns "OK" response + Given operation "DeleteRestrictionQuery" enabled + And there is a valid "restriction_query" in the system + 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 OK + + @skip-terraform-config @team:DataDog/logs-app + Scenario: Get a restriction query returns "Bad Request" response + Given operation "GetRestrictionQuery" enabled + And new "GetRestrictionQuery" request + 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/logs-app + Scenario: Get a restriction query returns "Not found" response + Given operation "GetRestrictionQuery" enabled + And new "GetRestrictionQuery" request + 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 + + @team:DataDog/logs-app + Scenario: Get a restriction query returns "OK" response + Given operation "GetRestrictionQuery" enabled + And there is a valid "restriction_query" in the system + 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 + + @skip-terraform-config @team:DataDog/logs-app + Scenario: Get all restriction queries for a given user returns "Bad Request" response + Given operation "ListUserRestrictionQueries" enabled + And new "ListUserRestrictionQueries" request + And request contains "user_id" parameter with value "malformed_id" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/logs-app + Scenario: Get all restriction queries for a given user returns "Not found" response + Given operation "ListUserRestrictionQueries" enabled + And new "ListUserRestrictionQueries" request + And request contains "user_id" parameter with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/logs-app + Scenario: Get all restriction queries for a given user returns "OK" response + Given operation "ListUserRestrictionQueries" enabled + And there is a valid "user" in the system + 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/logs-app + Scenario: Get restriction query for a given role returns "Bad Request" response + Given operation "GetRoleRestrictionQuery" enabled + And new "GetRoleRestrictionQuery" request + And request contains "role_id" parameter with value "malformed_id" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/logs-app + Scenario: Get restriction query for a given role returns "Not found" response + Given operation "GetRoleRestrictionQuery" enabled + And new "GetRoleRestrictionQuery" request + And request contains "role_id" parameter with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/logs-app + Scenario: Get restriction query for a given role returns "OK" response + Given operation "GetRoleRestrictionQuery" enabled + And there is a valid "role" in the system + 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-terraform-config @team:DataDog/logs-app + Scenario: Grant role to a restriction query returns "Bad Request" response + Given operation "AddRoleToRestrictionQuery" enabled + And new "AddRoleToRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "malformed_id" + 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 + + @skip-terraform-config @team:DataDog/logs-app + 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 with value "00000000-0000-0000-0000-000000000000" + 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 + + @team:DataDog/logs-app + Scenario: Grant role to a restriction query returns "OK" response + Given operation "AddRoleToRestrictionQuery" enabled + And there is a valid "restriction_query" in the system + And there is a valid "role" in the system + And new "AddRoleToRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + And body with value {"data": {"id": "{{ role.data.id }}", "type": "roles"}} + When the request is sent + Then the response status is 204 OK + + @skip-terraform-config @team:DataDog/logs-app + Scenario: List restriction queries returns "OK" response + Given operation "ListRestrictionQueries" enabled + And new "ListRestrictionQueries" request + When the request is sent + Then the response status is 200 OK + + @skip-terraform-config @team:DataDog/logs-app + 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 with value "malformed_id" + When the request is sent + Then the response status is 400 Bad Request + + @skip-terraform-config @team:DataDog/logs-app + 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 with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 404 Not found + + @team:DataDog/logs-app + Scenario: List roles for a restriction query returns "OK" response + Given operation "ListRestrictionQueryRoles" enabled + And there is a valid "restriction_query" in the system + 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 + + @skip @team:DataDog/logs-app + Scenario: Replace a restriction query returns "Bad Request" response + Given operation "ReplaceRestrictionQuery" enabled + And new "ReplaceRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "malformed_id" + And body with value {"data": {"attributes": {"restriction_query": "env:sandbox"}, "type": "logs_restriction_queries"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/logs-app + Scenario: Replace a restriction query returns "Not found" response + Given operation "ReplaceRestrictionQuery" enabled + And new "ReplaceRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + 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 @team:DataDog/logs-app + Scenario: Replace a restriction query returns "OK" response + Given operation "ReplaceRestrictionQuery" enabled + And there is a valid "restriction_query" in the system + And new "ReplaceRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + And body with value {"data": {"attributes": {"restriction_query": "env:staging"}, "type": "logs_restriction_queries"}} + When the request is sent + Then the response status is 200 OK + + @skip @skip-terraform-config @team:DataDog/logs-app + 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 with value "malformed_id" + 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/logs-app + 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 with value "00000000-0000-0000-0000-000000000000" + 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 + + @skip @team:DataDog/logs-app + Scenario: Revoke role from a restriction query returns "OK" response + Given operation "RemoveRoleFromRestrictionQuery" enabled + And there is a valid "restriction_query" in the system + And there is a valid "role" in the system + And new "RemoveRoleFromRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + And body with value {"data": {"id": "{{ role.data.id }}", "type": "roles"}} + When the request is sent + Then the response status is 204 OK + + @skip @skip-terraform-config @team:DataDog/logs-app + Scenario: Update a restriction query returns "Bad Request" response + Given operation "UpdateRestrictionQuery" enabled + And new "UpdateRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "malformed_id" + And body with value {"data": {"attributes": {"restriction_query": "env:sandbox"}, "type": "logs_restriction_queries"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @skip-terraform-config @team:DataDog/logs-app + Scenario: Update a restriction query returns "Not found" response + Given operation "UpdateRestrictionQuery" enabled + And new "UpdateRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + 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 @team:DataDog/logs-app + Scenario: Update a restriction query returns "OK" response + Given operation "UpdateRestrictionQuery" enabled + And there is a valid "restriction_query" in the system + And new "UpdateRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + And body with value {"data": {"attributes": {"restriction_query": "env:production"}, "type": "logs_restriction_queries"}} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 3799e64e630d..fefb1b32bb3b 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2443,6 +2443,79 @@ "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" + } + }, + "ReplaceRestrictionQuery": { + "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/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 63e87298198b..e650d69e5176 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -279,6 +279,17 @@ def initialize "v2.update_incident_notification_template": false, "v2.update_incident_todo": false, "v2.update_incident_type": false, + "v2.add_role_to_restriction_query": false, + "v2.create_restriction_query": false, + "v2.delete_restriction_query": false, + "v2.get_restriction_query": false, + "v2.get_role_restriction_query": false, + "v2.list_restriction_queries": false, + "v2.list_restriction_query_roles": false, + "v2.list_user_restriction_queries": false, + "v2.remove_role_from_restriction_query": false, + "v2.replace_restriction_query": false, + "v2.update_restriction_query": false, "v2.create_monitor_user_template": false, "v2.delete_monitor_user_template": false, "v2.get_monitor_user_template": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 427fdcf8659c..e9f85e78975b 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2823,6 +2823,7 @@ def overrides "v2.logs_query_options" => "LogsQueryOptions", "v2.logs_response_metadata" => "LogsResponseMetadata", "v2.logs_response_metadata_page" => "LogsResponseMetadataPage", + "v2.logs_restriction_queries_type" => "LogsRestrictionQueriesType", "v2.logs_sort" => "LogsSort", "v2.logs_sort_order" => "LogsSortOrder", "v2.logs_storage_tier" => "LogsStorageTier", @@ -3540,6 +3541,22 @@ def overrides "v2.restriction_policy_response" => "RestrictionPolicyResponse", "v2.restriction_policy_type" => "RestrictionPolicyType", "v2.restriction_policy_update_request" => "RestrictionPolicyUpdateRequest", + "v2.restriction_query_attributes" => "RestrictionQueryAttributes", + "v2.restriction_query_create_attributes" => "RestrictionQueryCreateAttributes", + "v2.restriction_query_create_data" => "RestrictionQueryCreateData", + "v2.restriction_query_create_payload" => "RestrictionQueryCreatePayload", + "v2.restriction_query_list_response" => "RestrictionQueryListResponse", + "v2.restriction_query_response_included_item" => "RestrictionQueryResponseIncludedItem", + "v2.restriction_query_role" => "RestrictionQueryRole", + "v2.restriction_query_role_attribute" => "RestrictionQueryRoleAttribute", + "v2.restriction_query_roles_response" => "RestrictionQueryRolesResponse", + "v2.restriction_query_update_attributes" => "RestrictionQueryUpdateAttributes", + "v2.restriction_query_update_data" => "RestrictionQueryUpdateData", + "v2.restriction_query_update_payload" => "RestrictionQueryUpdatePayload", + "v2.restriction_query_without_relationships" => "RestrictionQueryWithoutRelationships", + "v2.restriction_query_without_relationships_response" => "RestrictionQueryWithoutRelationshipsResponse", + "v2.restriction_query_with_relationships" => "RestrictionQueryWithRelationships", + "v2.restriction_query_with_relationships_response" => "RestrictionQueryWithRelationshipsResponse", "v2.retention_filter" => "RetentionFilter", "v2.retention_filter_all" => "RetentionFilterAll", "v2.retention_filter_all_attributes" => "RetentionFilterAllAttributes", @@ -4579,6 +4596,7 @@ def overrides "v2.logs_archives_api" => "LogsArchivesAPI", "v2.logs_custom_destinations_api" => "LogsCustomDestinationsAPI", "v2.logs_metrics_api" => "LogsMetricsAPI", + "v2.logs_restriction_queries_api" => "LogsRestrictionQueriesAPI", "v2.metrics_api" => "MetricsAPI", "v2.microsoft_teams_integration_api" => "MicrosoftTeamsIntegrationAPI", "v2.monitors_api" => "MonitorsAPI", diff --git a/lib/datadog_api_client/v2/api/logs_restriction_queries_api.rb b/lib/datadog_api_client/v2/api/logs_restriction_queries_api.rb new file mode 100644 index 000000000000..67dbeb449ebb --- /dev/null +++ b/lib/datadog_api_client/v2/api/logs_restriction_queries_api.rb @@ -0,0 +1,842 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class LogsRestrictionQueriesAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Grant role to a restriction query. + # + # @see #add_role_to_restriction_query_with_http_info + def add_role_to_restriction_query(restriction_query_id, body, opts = {}) + add_role_to_restriction_query_with_http_info(restriction_query_id, body, opts) + nil + end + + # Grant role to a restriction query. + # + # Adds a role to a restriction query. + # + # **Note**: This operation automatically grants the `logs_read_data` permission to the role if it doesn't already have it. + # + # @param restriction_query_id [String] The ID of the restriction query. + # @param body [RelationshipToRole] + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def add_role_to_restriction_query_with_http_info(restriction_query_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.add_role_to_restriction_query".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.add_role_to_restriction_query") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.add_role_to_restriction_query")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsRestrictionQueriesAPI.add_role_to_restriction_query ...' + end + # verify the required parameter 'restriction_query_id' is set + if @api_client.config.client_side_validation && restriction_query_id.nil? + fail ArgumentError, "Missing the required parameter 'restriction_query_id' when calling LogsRestrictionQueriesAPI.add_role_to_restriction_query" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling LogsRestrictionQueriesAPI.add_role_to_restriction_query" + end + # resource path + local_var_path = '/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles'.sub('{restriction_query_id}', CGI.escape(restriction_query_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :add_role_to_restriction_query, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsRestrictionQueriesAPI#add_role_to_restriction_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create a restriction query. + # + # @see #create_restriction_query_with_http_info + def create_restriction_query(body, opts = {}) + data, _status_code, _headers = create_restriction_query_with_http_info(body, opts) + data + end + + # Create a restriction query. + # + # Create a new restriction query for your organization. + # + # @param body [RestrictionQueryCreatePayload] + # @param opts [Hash] the optional parameters + # @return [Array<(RestrictionQueryWithoutRelationshipsResponse, Integer, Hash)>] RestrictionQueryWithoutRelationshipsResponse data, response status code and response headers + def create_restriction_query_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_restriction_query".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_restriction_query") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_restriction_query")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsRestrictionQueriesAPI.create_restriction_query ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling LogsRestrictionQueriesAPI.create_restriction_query" + end + # resource path + local_var_path = '/api/v2/logs/config/restriction_queries' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'RestrictionQueryWithoutRelationshipsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_restriction_query, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsRestrictionQueriesAPI#create_restriction_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete a restriction query. + # + # @see #delete_restriction_query_with_http_info + def delete_restriction_query(restriction_query_id, opts = {}) + delete_restriction_query_with_http_info(restriction_query_id, opts) + nil + end + + # Delete a restriction query. + # + # Deletes a restriction query. + # + # @param restriction_query_id [String] The ID of the restriction query. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_restriction_query_with_http_info(restriction_query_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_restriction_query".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_restriction_query") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_restriction_query")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsRestrictionQueriesAPI.delete_restriction_query ...' + end + # verify the required parameter 'restriction_query_id' is set + if @api_client.config.client_side_validation && restriction_query_id.nil? + fail ArgumentError, "Missing the required parameter 'restriction_query_id' when calling LogsRestrictionQueriesAPI.delete_restriction_query" + end + # resource path + local_var_path = '/api/v2/logs/config/restriction_queries/{restriction_query_id}'.sub('{restriction_query_id}', CGI.escape(restriction_query_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_restriction_query, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsRestrictionQueriesAPI#delete_restriction_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a restriction query. + # + # @see #get_restriction_query_with_http_info + def get_restriction_query(restriction_query_id, opts = {}) + data, _status_code, _headers = get_restriction_query_with_http_info(restriction_query_id, opts) + data + end + + # Get a restriction query. + # + # Get a restriction query in the organization specified by the restriction query's `restriction_query_id`. + # + # @param restriction_query_id [String] The ID of the restriction query. + # @param opts [Hash] the optional parameters + # @return [Array<(RestrictionQueryWithRelationshipsResponse, Integer, Hash)>] RestrictionQueryWithRelationshipsResponse data, response status code and response headers + def get_restriction_query_with_http_info(restriction_query_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_restriction_query".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_restriction_query") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_restriction_query")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsRestrictionQueriesAPI.get_restriction_query ...' + end + # verify the required parameter 'restriction_query_id' is set + if @api_client.config.client_side_validation && restriction_query_id.nil? + fail ArgumentError, "Missing the required parameter 'restriction_query_id' when calling LogsRestrictionQueriesAPI.get_restriction_query" + end + # resource path + local_var_path = '/api/v2/logs/config/restriction_queries/{restriction_query_id}'.sub('{restriction_query_id}', CGI.escape(restriction_query_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RestrictionQueryWithRelationshipsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_restriction_query, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsRestrictionQueriesAPI#get_restriction_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get restriction query for a given role. + # + # @see #get_role_restriction_query_with_http_info + def get_role_restriction_query(role_id, opts = {}) + data, _status_code, _headers = get_role_restriction_query_with_http_info(role_id, opts) + data + end + + # Get restriction query for a given role. + # + # Get restriction query for a given role. + # + # @param role_id [String] The ID of the role. + # @param opts [Hash] the optional parameters + # @return [Array<(RestrictionQueryListResponse, Integer, Hash)>] RestrictionQueryListResponse data, response status code and response headers + def get_role_restriction_query_with_http_info(role_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_role_restriction_query".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_role_restriction_query") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_role_restriction_query")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsRestrictionQueriesAPI.get_role_restriction_query ...' + end + # verify the required parameter 'role_id' is set + if @api_client.config.client_side_validation && role_id.nil? + fail ArgumentError, "Missing the required parameter 'role_id' when calling LogsRestrictionQueriesAPI.get_role_restriction_query" + end + # resource path + local_var_path = '/api/v2/logs/config/restriction_queries/role/{role_id}'.sub('{role_id}', CGI.escape(role_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RestrictionQueryListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_role_restriction_query, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsRestrictionQueriesAPI#get_role_restriction_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List restriction queries. + # + # @see #list_restriction_queries_with_http_info + def list_restriction_queries(opts = {}) + data, _status_code, _headers = list_restriction_queries_with_http_info(opts) + data + end + + # List restriction queries. + # + # Returns all restriction queries, including their names and IDs. + # + # @param opts [Hash] the optional parameters + # @option opts [Integer] :page_size Size for a given page. The maximum allowed value is 100. + # @option opts [Integer] :page_number Specific page number to return. + # @return [Array<(RestrictionQueryListResponse, Integer, Hash)>] RestrictionQueryListResponse data, response status code and response headers + def list_restriction_queries_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_restriction_queries".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_restriction_queries") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_restriction_queries")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsRestrictionQueriesAPI.list_restriction_queries ...' + end + # resource path + local_var_path = '/api/v2/logs/config/restriction_queries' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? + query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RestrictionQueryListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_restriction_queries, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsRestrictionQueriesAPI#list_restriction_queries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List roles for a restriction query. + # + # @see #list_restriction_query_roles_with_http_info + def list_restriction_query_roles(restriction_query_id, opts = {}) + data, _status_code, _headers = list_restriction_query_roles_with_http_info(restriction_query_id, opts) + data + end + + # List roles for a restriction query. + # + # Returns all roles that have a given restriction query. + # + # @param restriction_query_id [String] The ID of the restriction query. + # @param opts [Hash] the optional parameters + # @option opts [Integer] :page_size Size for a given page. The maximum allowed value is 100. + # @option opts [Integer] :page_number Specific page number to return. + # @return [Array<(RestrictionQueryRolesResponse, Integer, Hash)>] RestrictionQueryRolesResponse data, response status code and response headers + def list_restriction_query_roles_with_http_info(restriction_query_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_restriction_query_roles".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_restriction_query_roles") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_restriction_query_roles")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsRestrictionQueriesAPI.list_restriction_query_roles ...' + end + # verify the required parameter 'restriction_query_id' is set + if @api_client.config.client_side_validation && restriction_query_id.nil? + fail ArgumentError, "Missing the required parameter 'restriction_query_id' when calling LogsRestrictionQueriesAPI.list_restriction_query_roles" + end + # resource path + local_var_path = '/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles'.sub('{restriction_query_id}', CGI.escape(restriction_query_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? + query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RestrictionQueryRolesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_restriction_query_roles, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsRestrictionQueriesAPI#list_restriction_query_roles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get all restriction queries for a given user. + # + # @see #list_user_restriction_queries_with_http_info + def list_user_restriction_queries(user_id, opts = {}) + data, _status_code, _headers = list_user_restriction_queries_with_http_info(user_id, opts) + data + end + + # Get all restriction queries for a given user. + # + # Get all restriction queries for a given user. + # + # @param user_id [String] The ID of the user. + # @param opts [Hash] the optional parameters + # @return [Array<(RestrictionQueryListResponse, Integer, Hash)>] RestrictionQueryListResponse data, response status code and response headers + def list_user_restriction_queries_with_http_info(user_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_user_restriction_queries".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_user_restriction_queries") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_user_restriction_queries")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsRestrictionQueriesAPI.list_user_restriction_queries ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling LogsRestrictionQueriesAPI.list_user_restriction_queries" + end + # resource path + local_var_path = '/api/v2/logs/config/restriction_queries/user/{user_id}'.sub('{user_id}', CGI.escape(user_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RestrictionQueryListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_user_restriction_queries, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsRestrictionQueriesAPI#list_user_restriction_queries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Revoke role from a restriction query. + # + # @see #remove_role_from_restriction_query_with_http_info + def remove_role_from_restriction_query(restriction_query_id, body, opts = {}) + remove_role_from_restriction_query_with_http_info(restriction_query_id, body, opts) + nil + end + + # Revoke role from a restriction query. + # + # Removes a role from a restriction query. + # + # @param restriction_query_id [String] The ID of the restriction query. + # @param body [RelationshipToRole] + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def remove_role_from_restriction_query_with_http_info(restriction_query_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.remove_role_from_restriction_query".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.remove_role_from_restriction_query") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.remove_role_from_restriction_query")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsRestrictionQueriesAPI.remove_role_from_restriction_query ...' + end + # verify the required parameter 'restriction_query_id' is set + if @api_client.config.client_side_validation && restriction_query_id.nil? + fail ArgumentError, "Missing the required parameter 'restriction_query_id' when calling LogsRestrictionQueriesAPI.remove_role_from_restriction_query" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling LogsRestrictionQueriesAPI.remove_role_from_restriction_query" + end + # resource path + local_var_path = '/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles'.sub('{restriction_query_id}', CGI.escape(restriction_query_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :remove_role_from_restriction_query, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsRestrictionQueriesAPI#remove_role_from_restriction_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Replace a restriction query. + # + # @see #replace_restriction_query_with_http_info + def replace_restriction_query(restriction_query_id, body, opts = {}) + data, _status_code, _headers = replace_restriction_query_with_http_info(restriction_query_id, body, opts) + data + end + + # Replace a restriction query. + # + # Replace a restriction query. + # + # @param restriction_query_id [String] The ID of the restriction query. + # @param body [RestrictionQueryUpdatePayload] + # @param opts [Hash] the optional parameters + # @return [Array<(RestrictionQueryWithoutRelationshipsResponse, Integer, Hash)>] RestrictionQueryWithoutRelationshipsResponse data, response status code and response headers + def replace_restriction_query_with_http_info(restriction_query_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.replace_restriction_query".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.replace_restriction_query") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.replace_restriction_query")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsRestrictionQueriesAPI.replace_restriction_query ...' + end + # verify the required parameter 'restriction_query_id' is set + if @api_client.config.client_side_validation && restriction_query_id.nil? + fail ArgumentError, "Missing the required parameter 'restriction_query_id' when calling LogsRestrictionQueriesAPI.replace_restriction_query" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling LogsRestrictionQueriesAPI.replace_restriction_query" + end + # resource path + local_var_path = '/api/v2/logs/config/restriction_queries/{restriction_query_id}'.sub('{restriction_query_id}', CGI.escape(restriction_query_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'RestrictionQueryWithoutRelationshipsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :replace_restriction_query, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsRestrictionQueriesAPI#replace_restriction_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a restriction query. + # + # @see #update_restriction_query_with_http_info + def update_restriction_query(restriction_query_id, body, opts = {}) + data, _status_code, _headers = update_restriction_query_with_http_info(restriction_query_id, body, opts) + data + end + + # Update a restriction query. + # + # Edit a restriction query. + # + # @param restriction_query_id [String] The ID of the restriction query. + # @param body [RestrictionQueryUpdatePayload] + # @param opts [Hash] the optional parameters + # @return [Array<(RestrictionQueryWithoutRelationshipsResponse, Integer, Hash)>] RestrictionQueryWithoutRelationshipsResponse data, response status code and response headers + def update_restriction_query_with_http_info(restriction_query_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_restriction_query".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_restriction_query") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_restriction_query")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsRestrictionQueriesAPI.update_restriction_query ...' + end + # verify the required parameter 'restriction_query_id' is set + if @api_client.config.client_side_validation && restriction_query_id.nil? + fail ArgumentError, "Missing the required parameter 'restriction_query_id' when calling LogsRestrictionQueriesAPI.update_restriction_query" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling LogsRestrictionQueriesAPI.update_restriction_query" + end + # resource path + local_var_path = '/api/v2/logs/config/restriction_queries/{restriction_query_id}'.sub('{restriction_query_id}', CGI.escape(restriction_query_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'RestrictionQueryWithoutRelationshipsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_restriction_query, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsRestrictionQueriesAPI#update_restriction_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/logs_restriction_queries_type.rb b/lib/datadog_api_client/v2/models/logs_restriction_queries_type.rb new file mode 100644 index 000000000000..cf3d1a381987 --- /dev/null +++ b/lib/datadog_api_client/v2/models/logs_restriction_queries_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Restriction query resource type. + class LogsRestrictionQueriesType + include BaseEnumModel + + LOGS_RESTRICTION_QUERIES = "logs_restriction_queries".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_attributes.rb b/lib/datadog_api_client/v2/models/restriction_query_attributes.rb new file mode 100644 index 000000000000..0f88ebe69878 --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_attributes.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the restriction query. + class RestrictionQueryAttributes + include BaseGenericModel + + # Creation time of the restriction query. + attr_accessor :created_at + + # Email of the user who last modified this restriction query. + attr_accessor :last_modifier_email + + # Name of the user who last modified this restriction query. + attr_accessor :last_modifier_name + + # Time of last restriction query modification. + attr_accessor :modified_at + + # The query that defines the restriction. Only the content matching the query can be returned. + attr_accessor :restriction_query + + # Number of roles associated with this restriction query. + attr_accessor :role_count + + # Number of users associated with this restriction query. + attr_accessor :user_count + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at' => :'created_at', + :'last_modifier_email' => :'last_modifier_email', + :'last_modifier_name' => :'last_modifier_name', + :'modified_at' => :'modified_at', + :'restriction_query' => :'restriction_query', + :'role_count' => :'role_count', + :'user_count' => :'user_count' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at' => :'Time', + :'last_modifier_email' => :'String', + :'last_modifier_name' => :'String', + :'modified_at' => :'Time', + :'restriction_query' => :'String', + :'role_count' => :'Integer', + :'user_count' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'last_modifier_email') + self.last_modifier_email = attributes[:'last_modifier_email'] + end + + if attributes.key?(:'last_modifier_name') + self.last_modifier_name = attributes[:'last_modifier_name'] + end + + if attributes.key?(:'modified_at') + self.modified_at = attributes[:'modified_at'] + end + + if attributes.key?(:'restriction_query') + self.restriction_query = attributes[:'restriction_query'] + end + + if attributes.key?(:'role_count') + self.role_count = attributes[:'role_count'] + end + + if attributes.key?(:'user_count') + self.user_count = attributes[:'user_count'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_at == o.created_at && + last_modifier_email == o.last_modifier_email && + last_modifier_name == o.last_modifier_name && + modified_at == o.modified_at && + restriction_query == o.restriction_query && + role_count == o.role_count && + user_count == o.user_count && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at, last_modifier_email, last_modifier_name, modified_at, restriction_query, role_count, user_count, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_create_attributes.rb b/lib/datadog_api_client/v2/models/restriction_query_create_attributes.rb new file mode 100644 index 000000000000..db820fba835e --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_create_attributes.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the created restriction query. + class RestrictionQueryCreateAttributes + include BaseGenericModel + + # The restriction query. + attr_reader :restriction_query + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'restriction_query' => :'restriction_query' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'restriction_query' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryCreateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'restriction_query') + self.restriction_query = attributes[:'restriction_query'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @restriction_query.nil? + true + end + + # Custom attribute writer method with validation + # @param restriction_query [Object] Object to be assigned + # @!visibility private + def restriction_query=(restriction_query) + if restriction_query.nil? + fail ArgumentError, 'invalid value for "restriction_query", restriction_query cannot be nil.' + end + @restriction_query = restriction_query + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + restriction_query == o.restriction_query && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [restriction_query, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_create_data.rb b/lib/datadog_api_client/v2/models/restriction_query_create_data.rb new file mode 100644 index 000000000000..ee9251d2e151 --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_create_data.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data related to the creation of a restriction query. + class RestrictionQueryCreateData + include BaseGenericModel + + # Attributes of the created restriction query. + attr_accessor :attributes + + # Restriction query resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'RestrictionQueryCreateAttributes', + :'type' => :'LogsRestrictionQueriesType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryCreateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_create_payload.rb b/lib/datadog_api_client/v2/models/restriction_query_create_payload.rb new file mode 100644 index 000000000000..4b9bb5171a73 --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_create_payload.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Create a restriction query. + class RestrictionQueryCreatePayload + include BaseGenericModel + + # Data related to the creation of a restriction query. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'RestrictionQueryCreateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryCreatePayload` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_list_response.rb b/lib/datadog_api_client/v2/models/restriction_query_list_response.rb new file mode 100644 index 000000000000..0aeeb7f82da3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_list_response.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing information about multiple restriction queries. + class RestrictionQueryListResponse + include BaseGenericModel + + # Array of returned restriction queries. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryListResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_response_included_item.rb b/lib/datadog_api_client/v2/models/restriction_query_response_included_item.rb new file mode 100644 index 000000000000..14d7112d1ffa --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_response_included_item.rb @@ -0,0 +1,62 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # An object related to a restriction query. + module RestrictionQueryResponseIncludedItem + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'RestrictionQueryRole' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_role.rb b/lib/datadog_api_client/v2/models/restriction_query_role.rb new file mode 100644 index 000000000000..bf974be7cd19 --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_role.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Partial role object. + class RestrictionQueryRole + include BaseGenericModel + + # Attributes of the role for a restriction query. + attr_reader :attributes + + # ID of the role. + attr_reader :id + + # Roles type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'RestrictionQueryRoleAttribute', + :'id' => :'String', + :'type' => :'RolesType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryRole` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_role_attribute.rb b/lib/datadog_api_client/v2/models/restriction_query_role_attribute.rb new file mode 100644 index 000000000000..3f634ea831e5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_role_attribute.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the role for a restriction query. + class RestrictionQueryRoleAttribute + include BaseGenericModel + + # The role name. + attr_accessor :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryRoleAttribute` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_roles_response.rb b/lib/datadog_api_client/v2/models/restriction_query_roles_response.rb new file mode 100644 index 000000000000..a0c2f48dd5bb --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_roles_response.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing information about roles attached to a restriction query. + class RestrictionQueryRolesResponse + include BaseGenericModel + + # Array of roles. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryRolesResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_update_attributes.rb b/lib/datadog_api_client/v2/models/restriction_query_update_attributes.rb new file mode 100644 index 000000000000..9dff7072fcfe --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_update_attributes.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the edited restriction query. + class RestrictionQueryUpdateAttributes + include BaseGenericModel + + # The restriction query. + attr_reader :restriction_query + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'restriction_query' => :'restriction_query' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'restriction_query' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryUpdateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'restriction_query') + self.restriction_query = attributes[:'restriction_query'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @restriction_query.nil? + true + end + + # Custom attribute writer method with validation + # @param restriction_query [Object] Object to be assigned + # @!visibility private + def restriction_query=(restriction_query) + if restriction_query.nil? + fail ArgumentError, 'invalid value for "restriction_query", restriction_query cannot be nil.' + end + @restriction_query = restriction_query + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + restriction_query == o.restriction_query && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [restriction_query, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_update_data.rb b/lib/datadog_api_client/v2/models/restriction_query_update_data.rb new file mode 100644 index 000000000000..6d368e9930ba --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_update_data.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data related to the update of a restriction query. + class RestrictionQueryUpdateData + include BaseGenericModel + + # Attributes of the edited restriction query. + attr_accessor :attributes + + # Restriction query resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'RestrictionQueryUpdateAttributes', + :'type' => :'LogsRestrictionQueriesType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryUpdateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_update_payload.rb b/lib/datadog_api_client/v2/models/restriction_query_update_payload.rb new file mode 100644 index 000000000000..68afbe119ea9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_update_payload.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Update a restriction query. + class RestrictionQueryUpdatePayload + include BaseGenericModel + + # Data related to the update of a restriction query. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'RestrictionQueryUpdateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryUpdatePayload` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_with_relationships.rb b/lib/datadog_api_client/v2/models/restriction_query_with_relationships.rb new file mode 100644 index 000000000000..739a232c30d7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_with_relationships.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Restriction query object returned by the API. + class RestrictionQueryWithRelationships + include BaseGenericModel + + # Attributes of the restriction query. + attr_accessor :attributes + + # ID of the restriction query. + attr_accessor :id + + # Relationships of the user object. + attr_accessor :relationships + + # Restriction query resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'RestrictionQueryAttributes', + :'id' => :'String', + :'relationships' => :'UserRelationships', + :'type' => :'LogsRestrictionQueriesType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryWithRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_with_relationships_response.rb b/lib/datadog_api_client/v2/models/restriction_query_with_relationships_response.rb new file mode 100644 index 000000000000..2a32ef9583ff --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_with_relationships_response.rb @@ -0,0 +1,117 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing information about a single restriction query. + class RestrictionQueryWithRelationshipsResponse + include BaseGenericModel + + # Restriction query object returned by the API. + attr_accessor :data + + # Array of objects related to the restriction query. + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'RestrictionQueryWithRelationships', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryWithRelationshipsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_without_relationships.rb b/lib/datadog_api_client/v2/models/restriction_query_without_relationships.rb new file mode 100644 index 000000000000..d593704eceb2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_without_relationships.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Restriction query object returned by the API. + class RestrictionQueryWithoutRelationships + include BaseGenericModel + + # Attributes of the restriction query. + attr_accessor :attributes + + # ID of the restriction query. + attr_accessor :id + + # Restriction queries type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'RestrictionQueryAttributes', + :'id' => :'String', + :'type' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryWithoutRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/restriction_query_without_relationships_response.rb b/lib/datadog_api_client/v2/models/restriction_query_without_relationships_response.rb new file mode 100644 index 000000000000..3dea0cd10997 --- /dev/null +++ b/lib/datadog_api_client/v2/models/restriction_query_without_relationships_response.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing information about a single restriction query. + class RestrictionQueryWithoutRelationshipsResponse + include BaseGenericModel + + # Restriction query object returned by the API. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'RestrictionQueryWithoutRelationships' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RestrictionQueryWithoutRelationshipsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end