diff --git a/.apigentools-info b/.apigentools-info index 0ec0c9fc35d..7b5e1faa770 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-01 14:24:18.377100", - "spec_repo_commit": "d90ee2ef" + "regenerated": "2024-10-01 16:33:20.700054", + "spec_repo_commit": "763d3bd7" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-01 14:24:18.393189", - "spec_repo_commit": "d90ee2ef" + "regenerated": "2024-10-01 16:33:20.714316", + "spec_repo_commit": "763d3bd7" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ce325fb6281..bbc9b8df3a1 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -520,6 +520,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 @@ -13505,6 +13526,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: @@ -17972,6 +18002,175 @@ components: required: - data type: object + RestrictionQueryAttributes: + description: Attributes of the restriction query. + properties: + created_at: + description: Creation time of the restriction query. + example: '2020-03-17T21:06:44.000Z' + format: date-time + readOnly: true + type: string + modified_at: + description: Time of last restriction query modification. + example: '2020-03-17T21:15:15.000Z' + format: date-time + readOnly: true + type: string + restriction_query: + description: The query that defines the restriction. Only the content matching + the query can be returned. + example: env:sandbox + type: string + type: object + RestrictionQueryCreateAttributes: + description: Attributes of the created restriction query. + properties: + restriction_query: + description: The restriction query. + example: env:sandbox + type: string + type: object + RestrictionQueryCreateData: + description: Data related to the creation of a restriction query. + properties: + attributes: + $ref: '#/components/schemas/RestrictionQueryCreateAttributes' + type: + $ref: '#/components/schemas/LogsRestrictionQueriesType' + type: object + RestrictionQueryCreatePayload: + description: Create a restriction query. + properties: + data: + $ref: '#/components/schemas/RestrictionQueryCreateData' + type: object + RestrictionQueryListResponse: + description: Response containing information about multiple restriction queries. + properties: + data: + description: Array of returned restriction queries. + items: + $ref: '#/components/schemas/RestrictionQueryWithoutRelationships' + type: array + type: object + RestrictionQueryRelationships: + description: Relationships of the restriction query object. + properties: + roles: + $ref: '#/components/schemas/RelationshipToRoles' + type: object + RestrictionQueryResponseIncludedItem: + description: An object related to a restriction query. + discriminator: + mapping: + roles: '#/components/schemas/RestrictionQueryRole' + propertyName: type + oneOf: + - $ref: '#/components/schemas/RestrictionQueryRole' + RestrictionQueryRole: + description: Partial role object. + properties: + attributes: + $ref: '#/components/schemas/RestrictionQueryRoleAttribute' + id: + description: ID of the role. + example: <ROLE_ID> + type: string + type: + default: roles + description: Role resource type. + example: roles + readOnly: true + type: string + type: object + RestrictionQueryRoleAttribute: + description: Attributes of the role for a restriction query. + properties: + name: + description: The role name. + example: Datadog Admin Role + type: string + type: object + RestrictionQueryRolesResponse: + description: Response containing information about roles attached to a restriction + query. + properties: + data: + description: Array of roles. + items: + $ref: '#/components/schemas/RestrictionQueryRole' + type: array + type: object + RestrictionQueryUpdateAttributes: + description: Attributes of the edited restriction query. + properties: + restriction_query: + description: The restriction query. + example: env:sandbox + type: string + type: object + RestrictionQueryUpdateData: + description: Data related to the update of a restriction query. + properties: + attributes: + $ref: '#/components/schemas/RestrictionQueryUpdateAttributes' + type: + $ref: '#/components/schemas/LogsRestrictionQueriesType' + type: object + RestrictionQueryUpdatePayload: + description: Update a restriction query. + properties: + data: + $ref: '#/components/schemas/RestrictionQueryUpdateData' + type: object + RestrictionQueryWithRelationships: + description: Restriction query object returned by the API. + properties: + attributes: + $ref: '#/components/schemas/RestrictionQueryAttributes' + id: + description: ID of the restriction query. + example: 79a0e60a-644a-11ea-ad29-43329f7f58b5 + type: string + relationships: + $ref: '#/components/schemas/RestrictionQueryRelationships' + 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: @@ -32264,6 +32463,417 @@ 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: OPEN + permissions: [] + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create a new restriction query for your organization. + operationId: CreateRestrictionQuery + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryCreatePayload' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryWithoutRelationshipsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/logs/config/restriction_queries/role/{role_id}: + get: + description: Get restriction query for a given role. + operationId: GetRoleRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryRoleID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryListResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get restriction query for a given role + tags: + - Logs Restriction Queries + x-permission: + operator: OPEN + permissions: [] + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/logs/config/restriction_queries/user/{user_id}: + get: + description: Get all restriction queries for a given user. + operationId: ListUserRestrictionQueries + parameters: + - $ref: '#/components/parameters/RestrictionQueryUserID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryListResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get all restriction queries for a given user + tags: + - Logs Restriction Queries + x-permission: + operator: OPEN + permissions: [] + 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: OPEN + permissions: [] + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + patch: + description: Edit a restriction query. + operationId: UpdateRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryUpdatePayload' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryWithoutRelationshipsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/logs/config/restriction_queries/{restriction_query_id}/roles: + delete: + description: Removes a role from a restriction query. + operationId: RemoveRoleFromRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RelationshipToRole' + required: true + responses: + '204': + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Revoke role from a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Returns all roles that have a given restriction query. + operationId: ListRestrictionQueryRoles + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryRolesResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List roles for a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OPEN + permissions: [] + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Adds a role to a restriction query. + operationId: AddRoleToRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RelationshipToRole' + required: true + responses: + '204': + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Grant role to a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/logs/events: get: description: 'List endpoint returns logs that match a log search query. @@ -40880,6 +41490,47 @@ 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. + + + You need an API and application key with Admin rights to interact with this endpoint. + + + 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/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 1f108858c8e..50912e8c5e4 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -394,6 +394,16 @@ public class ApiClient { put("v2.updateIncidentAttachments", false); put("v2.updateIncidentIntegration", false); put("v2.updateIncidentTodo", false); + put("v2.addRoleToRestrictionQuery", false); + put("v2.createRestrictionQuery", false); + put("v2.deleteRestrictionQuery", false); + put("v2.getRestrictionQuery", false); + put("v2.getRoleRestrictionQuery", false); + put("v2.listRestrictionQueries", false); + put("v2.listRestrictionQueryRoles", false); + put("v2.listUserRestrictionQueries", false); + put("v2.removeRoleFromRestrictionQuery", false); + put("v2.updateRestrictionQuery", false); put("v2.queryScalarData", false); put("v2.queryTimeseriesData", false); put("v2.getFinding", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/LogsRestrictionQueriesApi.java b/src/main/java/com/datadog/api/client/v2/api/LogsRestrictionQueriesApi.java new file mode 100644 index 00000000000..1ac3f020212 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/LogsRestrictionQueriesApi.java @@ -0,0 +1,1851 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.RelationshipToRole; +import com.datadog.api.client.v2.model.RestrictionQueryCreatePayload; +import com.datadog.api.client.v2.model.RestrictionQueryListResponse; +import com.datadog.api.client.v2.model.RestrictionQueryRolesResponse; +import com.datadog.api.client.v2.model.RestrictionQueryUpdatePayload; +import com.datadog.api.client.v2.model.RestrictionQueryWithRelationshipsResponse; +import com.datadog.api.client.v2.model.RestrictionQueryWithoutRelationshipsResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LogsRestrictionQueriesApi { + private ApiClient apiClient; + + public LogsRestrictionQueriesApi() { + this(ApiClient.getDefaultApiClient()); + } + + public LogsRestrictionQueriesApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Grant role to a restriction query. + * + * <p>See {@link #addRoleToRestrictionQueryWithHttpInfo}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void addRoleToRestrictionQuery(String restrictionQueryId, RelationshipToRole body) + throws ApiException { + addRoleToRestrictionQueryWithHttpInfo(restrictionQueryId, body); + } + + /** + * Grant role to a restriction query. + * + * <p>See {@link #addRoleToRestrictionQueryWithHttpInfoAsync}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture<Void> addRoleToRestrictionQueryAsync( + String restrictionQueryId, RelationshipToRole body) { + return addRoleToRestrictionQueryWithHttpInfoAsync(restrictionQueryId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Adds a role to a restriction query. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * <table border="1"> + * <caption>Response details</caption> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 204 </td><td> OK </td><td> - </td></tr> + * <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> + * <tr><td> 403 </td><td> Authentication error </td><td> - </td></tr> + * <tr><td> 404 </td><td> Not found </td><td> - </td></tr> + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> + * </table> + */ + public ApiResponse<Void> addRoleToRestrictionQueryWithHttpInfo( + String restrictionQueryId, RelationshipToRole body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "addRoleToRestrictionQuery"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'restrictionQueryId' is set + if (restrictionQueryId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'restrictionQueryId' when calling" + + " addRoleToRestrictionQuery"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling addRoleToRestrictionQuery"); + } + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles" + .replaceAll( + "\\{" + "restriction_query_id" + "\\}", + apiClient.escapeString(restrictionQueryId.toString())); + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.addRoleToRestrictionQuery", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap<String, Object>(), + false, + null); + } + + /** + * Grant role to a restriction query. + * + * <p>See {@link #addRoleToRestrictionQueryWithHttpInfo}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture<ApiResponse<Void>> addRoleToRestrictionQueryWithHttpInfoAsync( + String restrictionQueryId, RelationshipToRole body) { + // Check if unstable operation is enabled + String operationId = "addRoleToRestrictionQuery"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'restrictionQueryId' is set + if (restrictionQueryId == null) { + CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'restrictionQueryId' when calling" + + " addRoleToRestrictionQuery")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling addRoleToRestrictionQuery")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles" + .replaceAll( + "\\{" + "restriction_query_id" + "\\}", + apiClient.escapeString(restrictionQueryId.toString())); + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.addRoleToRestrictionQuery", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap<String, Object>(), + false, + null); + } + + /** + * Create a restriction query. + * + * <p>See {@link #createRestrictionQueryWithHttpInfo}. + * + * @param body (required) + * @return RestrictionQueryWithoutRelationshipsResponse + * @throws ApiException if fails to make API call + */ + public RestrictionQueryWithoutRelationshipsResponse createRestrictionQuery( + RestrictionQueryCreatePayload body) throws ApiException { + return createRestrictionQueryWithHttpInfo(body).getData(); + } + + /** + * Create a restriction query. + * + * <p>See {@link #createRestrictionQueryWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<RestrictionQueryWithoutRelationshipsResponse> + */ + public CompletableFuture<RestrictionQueryWithoutRelationshipsResponse> + createRestrictionQueryAsync(RestrictionQueryCreatePayload body) { + return createRestrictionQueryWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new restriction query for your organization. + * + * @param body (required) + * @return ApiResponse<RestrictionQueryWithoutRelationshipsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * <table border="1"> + * <caption>Response details</caption> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> OK </td><td> - </td></tr> + * <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> + * <tr><td> 403 </td><td> Authentication error </td><td> - </td></tr> + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> + * </table> + */ + public ApiResponse<RestrictionQueryWithoutRelationshipsResponse> + createRestrictionQueryWithHttpInfo(RestrictionQueryCreatePayload body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createRestrictionQuery"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createRestrictionQuery"); + } + // create path and map variables + String localVarPath = "/api/v2/logs/config/restriction_queries"; + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.createRestrictionQuery", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap<String, Object>(), + false, + new GenericType<RestrictionQueryWithoutRelationshipsResponse>() {}); + } + + /** + * Create a restriction query. + * + * <p>See {@link #createRestrictionQueryWithHttpInfo}. + * + * @param body (required) + * @return + * CompletableFuture<ApiResponse<RestrictionQueryWithoutRelationshipsResponse>> + */ + public CompletableFuture<ApiResponse<RestrictionQueryWithoutRelationshipsResponse>> + createRestrictionQueryWithHttpInfoAsync(RestrictionQueryCreatePayload body) { + // Check if unstable operation is enabled + String operationId = "createRestrictionQuery"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture<ApiResponse<RestrictionQueryWithoutRelationshipsResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture<ApiResponse<RestrictionQueryWithoutRelationshipsResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createRestrictionQuery")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/logs/config/restriction_queries"; + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.createRestrictionQuery", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture<ApiResponse<RestrictionQueryWithoutRelationshipsResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap<String, Object>(), + false, + new GenericType<RestrictionQueryWithoutRelationshipsResponse>() {}); + } + + /** + * Delete a restriction query. + * + * <p>See {@link #deleteRestrictionQueryWithHttpInfo}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @throws ApiException if fails to make API call + */ + public void deleteRestrictionQuery(String restrictionQueryId) throws ApiException { + deleteRestrictionQueryWithHttpInfo(restrictionQueryId); + } + + /** + * Delete a restriction query. + * + * <p>See {@link #deleteRestrictionQueryWithHttpInfoAsync}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @return CompletableFuture + */ + public CompletableFuture<Void> deleteRestrictionQueryAsync(String restrictionQueryId) { + return deleteRestrictionQueryWithHttpInfoAsync(restrictionQueryId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Deletes a restriction query. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * <table border="1"> + * <caption>Response details</caption> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 204 </td><td> OK </td><td> - </td></tr> + * <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> + * <tr><td> 403 </td><td> Authentication error </td><td> - </td></tr> + * <tr><td> 404 </td><td> Not found </td><td> - </td></tr> + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> + * </table> + */ + public ApiResponse<Void> deleteRestrictionQueryWithHttpInfo(String restrictionQueryId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteRestrictionQuery"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'restrictionQueryId' is set + if (restrictionQueryId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'restrictionQueryId' when calling" + + " deleteRestrictionQuery"); + } + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}" + .replaceAll( + "\\{" + "restriction_query_id" + "\\}", + apiClient.escapeString(restrictionQueryId.toString())); + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.deleteRestrictionQuery", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap<String, Object>(), + false, + null); + } + + /** + * Delete a restriction query. + * + * <p>See {@link #deleteRestrictionQueryWithHttpInfo}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture<ApiResponse<Void>> deleteRestrictionQueryWithHttpInfoAsync( + String restrictionQueryId) { + // Check if unstable operation is enabled + String operationId = "deleteRestrictionQuery"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'restrictionQueryId' is set + if (restrictionQueryId == null) { + CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'restrictionQueryId' when calling" + + " deleteRestrictionQuery")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}" + .replaceAll( + "\\{" + "restriction_query_id" + "\\}", + apiClient.escapeString(restrictionQueryId.toString())); + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.deleteRestrictionQuery", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap<String, Object>(), + false, + null); + } + + /** + * Get a restriction query. + * + * <p>See {@link #getRestrictionQueryWithHttpInfo}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @return RestrictionQueryWithRelationshipsResponse + * @throws ApiException if fails to make API call + */ + public RestrictionQueryWithRelationshipsResponse getRestrictionQuery(String restrictionQueryId) + throws ApiException { + return getRestrictionQueryWithHttpInfo(restrictionQueryId).getData(); + } + + /** + * Get a restriction query. + * + * <p>See {@link #getRestrictionQueryWithHttpInfoAsync}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @return CompletableFuture<RestrictionQueryWithRelationshipsResponse> + */ + public CompletableFuture<RestrictionQueryWithRelationshipsResponse> getRestrictionQueryAsync( + String restrictionQueryId) { + return getRestrictionQueryWithHttpInfoAsync(restrictionQueryId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a restriction query in the organization specified by the restriction query's <code> + * restriction_query_id</code>. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @return ApiResponse<RestrictionQueryWithRelationshipsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * <table border="1"> + * <caption>Response details</caption> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> OK </td><td> - </td></tr> + * <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> + * <tr><td> 403 </td><td> Authentication error </td><td> - </td></tr> + * <tr><td> 404 </td><td> Not found </td><td> - </td></tr> + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> + * </table> + */ + public ApiResponse<RestrictionQueryWithRelationshipsResponse> getRestrictionQueryWithHttpInfo( + String restrictionQueryId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getRestrictionQuery"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'restrictionQueryId' is set + if (restrictionQueryId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'restrictionQueryId' when calling getRestrictionQuery"); + } + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}" + .replaceAll( + "\\{" + "restriction_query_id" + "\\}", + apiClient.escapeString(restrictionQueryId.toString())); + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.getRestrictionQuery", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap<String, Object>(), + false, + new GenericType<RestrictionQueryWithRelationshipsResponse>() {}); + } + + /** + * Get a restriction query. + * + * <p>See {@link #getRestrictionQueryWithHttpInfo}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @return CompletableFuture<ApiResponse<RestrictionQueryWithRelationshipsResponse>> + */ + public CompletableFuture<ApiResponse<RestrictionQueryWithRelationshipsResponse>> + getRestrictionQueryWithHttpInfoAsync(String restrictionQueryId) { + // Check if unstable operation is enabled + String operationId = "getRestrictionQuery"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture<ApiResponse<RestrictionQueryWithRelationshipsResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'restrictionQueryId' is set + if (restrictionQueryId == null) { + CompletableFuture<ApiResponse<RestrictionQueryWithRelationshipsResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'restrictionQueryId' when calling" + + " getRestrictionQuery")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}" + .replaceAll( + "\\{" + "restriction_query_id" + "\\}", + apiClient.escapeString(restrictionQueryId.toString())); + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.getRestrictionQuery", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture<ApiResponse<RestrictionQueryWithRelationshipsResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap<String, Object>(), + false, + new GenericType<RestrictionQueryWithRelationshipsResponse>() {}); + } + + /** + * Get restriction query for a given role. + * + * <p>See {@link #getRoleRestrictionQueryWithHttpInfo}. + * + * @param roleId The ID of the role. (required) + * @return RestrictionQueryListResponse + * @throws ApiException if fails to make API call + */ + public RestrictionQueryListResponse getRoleRestrictionQuery(String roleId) throws ApiException { + return getRoleRestrictionQueryWithHttpInfo(roleId).getData(); + } + + /** + * Get restriction query for a given role. + * + * <p>See {@link #getRoleRestrictionQueryWithHttpInfoAsync}. + * + * @param roleId The ID of the role. (required) + * @return CompletableFuture<RestrictionQueryListResponse> + */ + public CompletableFuture<RestrictionQueryListResponse> getRoleRestrictionQueryAsync( + String roleId) { + return getRoleRestrictionQueryWithHttpInfoAsync(roleId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get restriction query for a given role. + * + * @param roleId The ID of the role. (required) + * @return ApiResponse<RestrictionQueryListResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * <table border="1"> + * <caption>Response details</caption> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> OK </td><td> - </td></tr> + * <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> + * <tr><td> 403 </td><td> Authentication error </td><td> - </td></tr> + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> + * </table> + */ + public ApiResponse<RestrictionQueryListResponse> getRoleRestrictionQueryWithHttpInfo( + String roleId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getRoleRestrictionQuery"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'roleId' is set + if (roleId == null) { + throw new ApiException( + 400, "Missing the required parameter 'roleId' when calling getRoleRestrictionQuery"); + } + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/role/{role_id}" + .replaceAll("\\{" + "role_id" + "\\}", apiClient.escapeString(roleId.toString())); + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.getRoleRestrictionQuery", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap<String, Object>(), + false, + new GenericType<RestrictionQueryListResponse>() {}); + } + + /** + * Get restriction query for a given role. + * + * <p>See {@link #getRoleRestrictionQueryWithHttpInfo}. + * + * @param roleId The ID of the role. (required) + * @return CompletableFuture<ApiResponse<RestrictionQueryListResponse>> + */ + public CompletableFuture<ApiResponse<RestrictionQueryListResponse>> + getRoleRestrictionQueryWithHttpInfoAsync(String roleId) { + // Check if unstable operation is enabled + String operationId = "getRoleRestrictionQuery"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture<ApiResponse<RestrictionQueryListResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'roleId' is set + if (roleId == null) { + CompletableFuture<ApiResponse<RestrictionQueryListResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'roleId' when calling getRoleRestrictionQuery")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/role/{role_id}" + .replaceAll("\\{" + "role_id" + "\\}", apiClient.escapeString(roleId.toString())); + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.getRoleRestrictionQuery", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture<ApiResponse<RestrictionQueryListResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap<String, Object>(), + false, + new GenericType<RestrictionQueryListResponse>() {}); + } + + /** Manage optional parameters to listRestrictionQueries. */ + public static class ListRestrictionQueriesOptionalParameters { + private Long pageSize; + private Long pageNumber; + + /** + * Set pageSize. + * + * @param pageSize Size for a given page. The maximum allowed value is 100. (optional, default + * to 10) + * @return ListRestrictionQueriesOptionalParameters + */ + public ListRestrictionQueriesOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Set pageNumber. + * + * @param pageNumber Specific page number to return. (optional, default to 0) + * @return ListRestrictionQueriesOptionalParameters + */ + public ListRestrictionQueriesOptionalParameters pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + } + + /** + * List restriction queries. + * + * <p>See {@link #listRestrictionQueriesWithHttpInfo}. + * + * @return RestrictionQueryListResponse + * @throws ApiException if fails to make API call + */ + public RestrictionQueryListResponse listRestrictionQueries() throws ApiException { + return listRestrictionQueriesWithHttpInfo(new ListRestrictionQueriesOptionalParameters()) + .getData(); + } + + /** + * List restriction queries. + * + * <p>See {@link #listRestrictionQueriesWithHttpInfoAsync}. + * + * @return CompletableFuture<RestrictionQueryListResponse> + */ + public CompletableFuture<RestrictionQueryListResponse> listRestrictionQueriesAsync() { + return listRestrictionQueriesWithHttpInfoAsync(new ListRestrictionQueriesOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List restriction queries. + * + * <p>See {@link #listRestrictionQueriesWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return RestrictionQueryListResponse + * @throws ApiException if fails to make API call + */ + public RestrictionQueryListResponse listRestrictionQueries( + ListRestrictionQueriesOptionalParameters parameters) throws ApiException { + return listRestrictionQueriesWithHttpInfo(parameters).getData(); + } + + /** + * List restriction queries. + * + * <p>See {@link #listRestrictionQueriesWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<RestrictionQueryListResponse> + */ + public CompletableFuture<RestrictionQueryListResponse> listRestrictionQueriesAsync( + ListRestrictionQueriesOptionalParameters parameters) { + return listRestrictionQueriesWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Returns all restriction queries, including their names and IDs. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<RestrictionQueryListResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * <table border="1"> + * <caption>Response details</caption> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> OK </td><td> - </td></tr> + * <tr><td> 403 </td><td> Authentication error </td><td> - </td></tr> + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> + * </table> + */ + public ApiResponse<RestrictionQueryListResponse> listRestrictionQueriesWithHttpInfo( + ListRestrictionQueriesOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listRestrictionQueries"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + // create path and map variables + String localVarPath = "/api/v2/logs/config/restriction_queries"; + + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.listRestrictionQueries", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap<String, Object>(), + false, + new GenericType<RestrictionQueryListResponse>() {}); + } + + /** + * List restriction queries. + * + * <p>See {@link #listRestrictionQueriesWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<RestrictionQueryListResponse>> + */ + public CompletableFuture<ApiResponse<RestrictionQueryListResponse>> + listRestrictionQueriesWithHttpInfoAsync(ListRestrictionQueriesOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listRestrictionQueries"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture<ApiResponse<RestrictionQueryListResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + // create path and map variables + String localVarPath = "/api/v2/logs/config/restriction_queries"; + + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.listRestrictionQueries", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture<ApiResponse<RestrictionQueryListResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap<String, Object>(), + false, + new GenericType<RestrictionQueryListResponse>() {}); + } + + /** Manage optional parameters to listRestrictionQueryRoles. */ + public static class ListRestrictionQueryRolesOptionalParameters { + private Long pageSize; + private Long pageNumber; + + /** + * Set pageSize. + * + * @param pageSize Size for a given page. The maximum allowed value is 100. (optional, default + * to 10) + * @return ListRestrictionQueryRolesOptionalParameters + */ + public ListRestrictionQueryRolesOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Set pageNumber. + * + * @param pageNumber Specific page number to return. (optional, default to 0) + * @return ListRestrictionQueryRolesOptionalParameters + */ + public ListRestrictionQueryRolesOptionalParameters pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + } + + /** + * List roles for a restriction query. + * + * <p>See {@link #listRestrictionQueryRolesWithHttpInfo}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @return RestrictionQueryRolesResponse + * @throws ApiException if fails to make API call + */ + public RestrictionQueryRolesResponse listRestrictionQueryRoles(String restrictionQueryId) + throws ApiException { + return listRestrictionQueryRolesWithHttpInfo( + restrictionQueryId, new ListRestrictionQueryRolesOptionalParameters()) + .getData(); + } + + /** + * List roles for a restriction query. + * + * <p>See {@link #listRestrictionQueryRolesWithHttpInfoAsync}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @return CompletableFuture<RestrictionQueryRolesResponse> + */ + public CompletableFuture<RestrictionQueryRolesResponse> listRestrictionQueryRolesAsync( + String restrictionQueryId) { + return listRestrictionQueryRolesWithHttpInfoAsync( + restrictionQueryId, new ListRestrictionQueryRolesOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List roles for a restriction query. + * + * <p>See {@link #listRestrictionQueryRolesWithHttpInfo}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param parameters Optional parameters for the request. + * @return RestrictionQueryRolesResponse + * @throws ApiException if fails to make API call + */ + public RestrictionQueryRolesResponse listRestrictionQueryRoles( + String restrictionQueryId, ListRestrictionQueryRolesOptionalParameters parameters) + throws ApiException { + return listRestrictionQueryRolesWithHttpInfo(restrictionQueryId, parameters).getData(); + } + + /** + * List roles for a restriction query. + * + * <p>See {@link #listRestrictionQueryRolesWithHttpInfoAsync}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<RestrictionQueryRolesResponse> + */ + public CompletableFuture<RestrictionQueryRolesResponse> listRestrictionQueryRolesAsync( + String restrictionQueryId, ListRestrictionQueryRolesOptionalParameters parameters) { + return listRestrictionQueryRolesWithHttpInfoAsync(restrictionQueryId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Returns all roles that have a given restriction query. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<RestrictionQueryRolesResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * <table border="1"> + * <caption>Response details</caption> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> OK </td><td> - </td></tr> + * <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> + * <tr><td> 403 </td><td> Authentication error </td><td> - </td></tr> + * <tr><td> 404 </td><td> Not found </td><td> - </td></tr> + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> + * </table> + */ + public ApiResponse<RestrictionQueryRolesResponse> listRestrictionQueryRolesWithHttpInfo( + String restrictionQueryId, ListRestrictionQueryRolesOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "listRestrictionQueryRoles"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'restrictionQueryId' is set + if (restrictionQueryId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'restrictionQueryId' when calling" + + " listRestrictionQueryRoles"); + } + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles" + .replaceAll( + "\\{" + "restriction_query_id" + "\\}", + apiClient.escapeString(restrictionQueryId.toString())); + + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.listRestrictionQueryRoles", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap<String, Object>(), + false, + new GenericType<RestrictionQueryRolesResponse>() {}); + } + + /** + * List roles for a restriction query. + * + * <p>See {@link #listRestrictionQueryRolesWithHttpInfo}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<RestrictionQueryRolesResponse>> + */ + public CompletableFuture<ApiResponse<RestrictionQueryRolesResponse>> + listRestrictionQueryRolesWithHttpInfoAsync( + String restrictionQueryId, ListRestrictionQueryRolesOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listRestrictionQueryRoles"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture<ApiResponse<RestrictionQueryRolesResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'restrictionQueryId' is set + if (restrictionQueryId == null) { + CompletableFuture<ApiResponse<RestrictionQueryRolesResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'restrictionQueryId' when calling" + + " listRestrictionQueryRoles")); + return result; + } + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles" + .replaceAll( + "\\{" + "restriction_query_id" + "\\}", + apiClient.escapeString(restrictionQueryId.toString())); + + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.listRestrictionQueryRoles", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture<ApiResponse<RestrictionQueryRolesResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap<String, Object>(), + false, + new GenericType<RestrictionQueryRolesResponse>() {}); + } + + /** + * Get all restriction queries for a given user. + * + * <p>See {@link #listUserRestrictionQueriesWithHttpInfo}. + * + * @param userId The ID of the user. (required) + * @return RestrictionQueryListResponse + * @throws ApiException if fails to make API call + */ + public RestrictionQueryListResponse listUserRestrictionQueries(String userId) + throws ApiException { + return listUserRestrictionQueriesWithHttpInfo(userId).getData(); + } + + /** + * Get all restriction queries for a given user. + * + * <p>See {@link #listUserRestrictionQueriesWithHttpInfoAsync}. + * + * @param userId The ID of the user. (required) + * @return CompletableFuture<RestrictionQueryListResponse> + */ + public CompletableFuture<RestrictionQueryListResponse> listUserRestrictionQueriesAsync( + String userId) { + return listUserRestrictionQueriesWithHttpInfoAsync(userId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all restriction queries for a given user. + * + * @param userId The ID of the user. (required) + * @return ApiResponse<RestrictionQueryListResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * <table border="1"> + * <caption>Response details</caption> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> OK </td><td> - </td></tr> + * <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> + * <tr><td> 403 </td><td> Authentication error </td><td> - </td></tr> + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> + * </table> + */ + public ApiResponse<RestrictionQueryListResponse> listUserRestrictionQueriesWithHttpInfo( + String userId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listUserRestrictionQueries"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException( + 400, "Missing the required parameter 'userId' when calling listUserRestrictionQueries"); + } + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/user/{user_id}" + .replaceAll("\\{" + "user_id" + "\\}", apiClient.escapeString(userId.toString())); + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.listUserRestrictionQueries", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap<String, Object>(), + false, + new GenericType<RestrictionQueryListResponse>() {}); + } + + /** + * Get all restriction queries for a given user. + * + * <p>See {@link #listUserRestrictionQueriesWithHttpInfo}. + * + * @param userId The ID of the user. (required) + * @return CompletableFuture<ApiResponse<RestrictionQueryListResponse>> + */ + public CompletableFuture<ApiResponse<RestrictionQueryListResponse>> + listUserRestrictionQueriesWithHttpInfoAsync(String userId) { + // Check if unstable operation is enabled + String operationId = "listUserRestrictionQueries"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture<ApiResponse<RestrictionQueryListResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'userId' is set + if (userId == null) { + CompletableFuture<ApiResponse<RestrictionQueryListResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'userId' when calling listUserRestrictionQueries")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/user/{user_id}" + .replaceAll("\\{" + "user_id" + "\\}", apiClient.escapeString(userId.toString())); + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.listUserRestrictionQueries", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture<ApiResponse<RestrictionQueryListResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap<String, Object>(), + false, + new GenericType<RestrictionQueryListResponse>() {}); + } + + /** + * Revoke role from a restriction query. + * + * <p>See {@link #removeRoleFromRestrictionQueryWithHttpInfo}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void removeRoleFromRestrictionQuery(String restrictionQueryId, RelationshipToRole body) + throws ApiException { + removeRoleFromRestrictionQueryWithHttpInfo(restrictionQueryId, body); + } + + /** + * Revoke role from a restriction query. + * + * <p>See {@link #removeRoleFromRestrictionQueryWithHttpInfoAsync}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture<Void> removeRoleFromRestrictionQueryAsync( + String restrictionQueryId, RelationshipToRole body) { + return removeRoleFromRestrictionQueryWithHttpInfoAsync(restrictionQueryId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Removes a role from a restriction query. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * <table border="1"> + * <caption>Response details</caption> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 204 </td><td> OK </td><td> - </td></tr> + * <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> + * <tr><td> 403 </td><td> Authentication error </td><td> - </td></tr> + * <tr><td> 404 </td><td> Not found </td><td> - </td></tr> + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> + * </table> + */ + public ApiResponse<Void> removeRoleFromRestrictionQueryWithHttpInfo( + String restrictionQueryId, RelationshipToRole body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "removeRoleFromRestrictionQuery"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'restrictionQueryId' is set + if (restrictionQueryId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'restrictionQueryId' when calling" + + " removeRoleFromRestrictionQuery"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling removeRoleFromRestrictionQuery"); + } + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles" + .replaceAll( + "\\{" + "restriction_query_id" + "\\}", + apiClient.escapeString(restrictionQueryId.toString())); + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.removeRoleFromRestrictionQuery", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap<String, Object>(), + false, + null); + } + + /** + * Revoke role from a restriction query. + * + * <p>See {@link #removeRoleFromRestrictionQueryWithHttpInfo}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture<ApiResponse<Void>> removeRoleFromRestrictionQueryWithHttpInfoAsync( + String restrictionQueryId, RelationshipToRole body) { + // Check if unstable operation is enabled + String operationId = "removeRoleFromRestrictionQuery"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'restrictionQueryId' is set + if (restrictionQueryId == null) { + CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'restrictionQueryId' when calling" + + " removeRoleFromRestrictionQuery")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling removeRoleFromRestrictionQuery")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles" + .replaceAll( + "\\{" + "restriction_query_id" + "\\}", + apiClient.escapeString(restrictionQueryId.toString())); + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.removeRoleFromRestrictionQuery", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap<String, Object>(), + false, + null); + } + + /** + * Update a restriction query. + * + * <p>See {@link #updateRestrictionQueryWithHttpInfo}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param body (required) + * @return RestrictionQueryWithoutRelationshipsResponse + * @throws ApiException if fails to make API call + */ + public RestrictionQueryWithoutRelationshipsResponse updateRestrictionQuery( + String restrictionQueryId, RestrictionQueryUpdatePayload body) throws ApiException { + return updateRestrictionQueryWithHttpInfo(restrictionQueryId, body).getData(); + } + + /** + * Update a restriction query. + * + * <p>See {@link #updateRestrictionQueryWithHttpInfoAsync}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param body (required) + * @return CompletableFuture<RestrictionQueryWithoutRelationshipsResponse> + */ + public CompletableFuture<RestrictionQueryWithoutRelationshipsResponse> + updateRestrictionQueryAsync(String restrictionQueryId, RestrictionQueryUpdatePayload body) { + return updateRestrictionQueryWithHttpInfoAsync(restrictionQueryId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Edit a restriction query. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param body (required) + * @return ApiResponse<RestrictionQueryWithoutRelationshipsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * <table border="1"> + * <caption>Response details</caption> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> OK </td><td> - </td></tr> + * <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> + * <tr><td> 403 </td><td> Authentication error </td><td> - </td></tr> + * <tr><td> 404 </td><td> Not found </td><td> - </td></tr> + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> + * </table> + */ + public ApiResponse<RestrictionQueryWithoutRelationshipsResponse> + updateRestrictionQueryWithHttpInfo( + String restrictionQueryId, RestrictionQueryUpdatePayload body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateRestrictionQuery"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'restrictionQueryId' is set + if (restrictionQueryId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'restrictionQueryId' when calling" + + " updateRestrictionQuery"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateRestrictionQuery"); + } + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}" + .replaceAll( + "\\{" + "restriction_query_id" + "\\}", + apiClient.escapeString(restrictionQueryId.toString())); + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.updateRestrictionQuery", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap<String, Object>(), + false, + new GenericType<RestrictionQueryWithoutRelationshipsResponse>() {}); + } + + /** + * Update a restriction query. + * + * <p>See {@link #updateRestrictionQueryWithHttpInfo}. + * + * @param restrictionQueryId The ID of the restriction query. (required) + * @param body (required) + * @return + * CompletableFuture<ApiResponse<RestrictionQueryWithoutRelationshipsResponse>> + */ + public CompletableFuture<ApiResponse<RestrictionQueryWithoutRelationshipsResponse>> + updateRestrictionQueryWithHttpInfoAsync( + String restrictionQueryId, RestrictionQueryUpdatePayload body) { + // Check if unstable operation is enabled + String operationId = "updateRestrictionQuery"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture<ApiResponse<RestrictionQueryWithoutRelationshipsResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'restrictionQueryId' is set + if (restrictionQueryId == null) { + CompletableFuture<ApiResponse<RestrictionQueryWithoutRelationshipsResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'restrictionQueryId' when calling" + + " updateRestrictionQuery")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture<ApiResponse<RestrictionQueryWithoutRelationshipsResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updateRestrictionQuery")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/logs/config/restriction_queries/{restriction_query_id}" + .replaceAll( + "\\{" + "restriction_query_id" + "\\}", + apiClient.escapeString(restrictionQueryId.toString())); + + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.LogsRestrictionQueriesApi.updateRestrictionQuery", + localVarPath, + new ArrayList<Pair>(), + localVarHeaderParams, + new HashMap<String, String>(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture<ApiResponse<RestrictionQueryWithoutRelationshipsResponse>> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap<String, Object>(), + false, + new GenericType<RestrictionQueryWithoutRelationshipsResponse>() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LogsRestrictionQueriesType.java b/src/main/java/com/datadog/api/client/v2/model/LogsRestrictionQueriesType.java new file mode 100644 index 00000000000..8a34072570d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LogsRestrictionQueriesType.java @@ -0,0 +1,57 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Restriction query resource type. */ +@JsonSerialize(using = LogsRestrictionQueriesType.LogsRestrictionQueriesTypeSerializer.class) +public class LogsRestrictionQueriesType extends ModelEnum<String> { + + private static final Set<String> allowedValues = + new HashSet<String>(Arrays.asList("logs_restriction_queries")); + + public static final LogsRestrictionQueriesType LOGS_RESTRICTION_QUERIES = + new LogsRestrictionQueriesType("logs_restriction_queries"); + + LogsRestrictionQueriesType(String value) { + super(value, allowedValues); + } + + public static class LogsRestrictionQueriesTypeSerializer + extends StdSerializer<LogsRestrictionQueriesType> { + public LogsRestrictionQueriesTypeSerializer(Class<LogsRestrictionQueriesType> t) { + super(t); + } + + public LogsRestrictionQueriesTypeSerializer() { + this(null); + } + + @Override + public void serialize( + LogsRestrictionQueriesType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static LogsRestrictionQueriesType fromValue(String value) { + return new LogsRestrictionQueriesType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryAttributes.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryAttributes.java new file mode 100644 index 00000000000..05ccb80d7a1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryAttributes.java @@ -0,0 +1,175 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes of the restriction query. */ +@JsonPropertyOrder({ + RestrictionQueryAttributes.JSON_PROPERTY_CREATED_AT, + RestrictionQueryAttributes.JSON_PROPERTY_MODIFIED_AT, + RestrictionQueryAttributes.JSON_PROPERTY_RESTRICTION_QUERY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; + private OffsetDateTime modifiedAt; + + public static final String JSON_PROPERTY_RESTRICTION_QUERY = "restriction_query"; + private String restrictionQuery; + + /** + * Creation time of the restriction query. + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Time of last restriction query modification. + * + * @return modifiedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MODIFIED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getModifiedAt() { + return modifiedAt; + } + + public RestrictionQueryAttributes restrictionQuery(String restrictionQuery) { + this.restrictionQuery = restrictionQuery; + return this; + } + + /** + * The query that defines the restriction. Only the content matching the query can be returned. + * + * @return restrictionQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESTRICTION_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRestrictionQuery() { + return restrictionQuery; + } + + public void setRestrictionQuery(String restrictionQuery) { + this.restrictionQuery = restrictionQuery; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryAttributes + */ + @JsonAnySetter + public RestrictionQueryAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryAttributes restrictionQueryAttributes = (RestrictionQueryAttributes) o; + return Objects.equals(this.createdAt, restrictionQueryAttributes.createdAt) + && Objects.equals(this.modifiedAt, restrictionQueryAttributes.modifiedAt) + && Objects.equals(this.restrictionQuery, restrictionQueryAttributes.restrictionQuery) + && Objects.equals( + this.additionalProperties, restrictionQueryAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, modifiedAt, restrictionQuery, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); + sb.append(" restrictionQuery: ").append(toIndentedString(restrictionQuery)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryCreateAttributes.java new file mode 100644 index 00000000000..07a0ee227fe --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryCreateAttributes.java @@ -0,0 +1,137 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes of the created restriction query. */ +@JsonPropertyOrder({RestrictionQueryCreateAttributes.JSON_PROPERTY_RESTRICTION_QUERY}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryCreateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_RESTRICTION_QUERY = "restriction_query"; + private String restrictionQuery; + + public RestrictionQueryCreateAttributes restrictionQuery(String restrictionQuery) { + this.restrictionQuery = restrictionQuery; + return this; + } + + /** + * The restriction query. + * + * @return restrictionQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESTRICTION_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRestrictionQuery() { + return restrictionQuery; + } + + public void setRestrictionQuery(String restrictionQuery) { + this.restrictionQuery = restrictionQuery; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryCreateAttributes + */ + @JsonAnySetter + public RestrictionQueryCreateAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryCreateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryCreateAttributes restrictionQueryCreateAttributes = + (RestrictionQueryCreateAttributes) o; + return Objects.equals(this.restrictionQuery, restrictionQueryCreateAttributes.restrictionQuery) + && Objects.equals( + this.additionalProperties, restrictionQueryCreateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(restrictionQuery, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryCreateAttributes {\n"); + sb.append(" restrictionQuery: ").append(toIndentedString(restrictionQuery)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryCreateData.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryCreateData.java new file mode 100644 index 00000000000..775db7d9244 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryCreateData.java @@ -0,0 +1,170 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data related to the creation of a restriction query. */ +@JsonPropertyOrder({ + RestrictionQueryCreateData.JSON_PROPERTY_ATTRIBUTES, + RestrictionQueryCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private RestrictionQueryCreateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LogsRestrictionQueriesType type = LogsRestrictionQueriesType.LOGS_RESTRICTION_QUERIES; + + public RestrictionQueryCreateData attributes(RestrictionQueryCreateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the created restriction query. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RestrictionQueryCreateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(RestrictionQueryCreateAttributes attributes) { + this.attributes = attributes; + } + + public RestrictionQueryCreateData type(LogsRestrictionQueriesType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Restriction query resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public LogsRestrictionQueriesType getType() { + return type; + } + + public void setType(LogsRestrictionQueriesType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryCreateData + */ + @JsonAnySetter + public RestrictionQueryCreateData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryCreateData restrictionQueryCreateData = (RestrictionQueryCreateData) o; + return Objects.equals(this.attributes, restrictionQueryCreateData.attributes) + && Objects.equals(this.type, restrictionQueryCreateData.type) + && Objects.equals( + this.additionalProperties, restrictionQueryCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryCreateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryCreatePayload.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryCreatePayload.java new file mode 100644 index 00000000000..1c46ae2e825 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryCreatePayload.java @@ -0,0 +1,137 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Create a restriction query. */ +@JsonPropertyOrder({RestrictionQueryCreatePayload.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryCreatePayload { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private RestrictionQueryCreateData data; + + public RestrictionQueryCreatePayload data(RestrictionQueryCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data related to the creation of a restriction query. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RestrictionQueryCreateData getData() { + return data; + } + + public void setData(RestrictionQueryCreateData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryCreatePayload + */ + @JsonAnySetter + public RestrictionQueryCreatePayload putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryCreatePayload object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryCreatePayload restrictionQueryCreatePayload = (RestrictionQueryCreatePayload) o; + return Objects.equals(this.data, restrictionQueryCreatePayload.data) + && Objects.equals( + this.additionalProperties, restrictionQueryCreatePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryCreatePayload {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryListResponse.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryListResponse.java new file mode 100644 index 00000000000..2eb7a68cdea --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryListResponse.java @@ -0,0 +1,150 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing information about multiple restriction queries. */ +@JsonPropertyOrder({RestrictionQueryListResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryListResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List<RestrictionQueryWithoutRelationships> data = null; + + public RestrictionQueryListResponse data(List<RestrictionQueryWithoutRelationships> data) { + this.data = data; + for (RestrictionQueryWithoutRelationships item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public RestrictionQueryListResponse addDataItem(RestrictionQueryWithoutRelationships dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array of returned restriction queries. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<RestrictionQueryWithoutRelationships> getData() { + return data; + } + + public void setData(List<RestrictionQueryWithoutRelationships> data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryListResponse + */ + @JsonAnySetter + public RestrictionQueryListResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryListResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryListResponse restrictionQueryListResponse = (RestrictionQueryListResponse) o; + return Objects.equals(this.data, restrictionQueryListResponse.data) + && Objects.equals( + this.additionalProperties, restrictionQueryListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryRelationships.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryRelationships.java new file mode 100644 index 00000000000..c16f504e698 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryRelationships.java @@ -0,0 +1,137 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Relationships of the restriction query object. */ +@JsonPropertyOrder({RestrictionQueryRelationships.JSON_PROPERTY_ROLES}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ROLES = "roles"; + private RelationshipToRoles roles; + + public RestrictionQueryRelationships roles(RelationshipToRoles roles) { + this.roles = roles; + this.unparsed |= roles.unparsed; + return this; + } + + /** + * Relationship to roles. + * + * @return roles + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ROLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RelationshipToRoles getRoles() { + return roles; + } + + public void setRoles(RelationshipToRoles roles) { + this.roles = roles; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryRelationships + */ + @JsonAnySetter + public RestrictionQueryRelationships putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryRelationships restrictionQueryRelationships = (RestrictionQueryRelationships) o; + return Objects.equals(this.roles, restrictionQueryRelationships.roles) + && Objects.equals( + this.additionalProperties, restrictionQueryRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(roles, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryRelationships {\n"); + sb.append(" roles: ").append(toIndentedString(roles)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryResponseIncludedItem.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryResponseIncludedItem.java new file mode 100644 index 00000000000..5955109bc61 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryResponseIncludedItem.java @@ -0,0 +1,221 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = + RestrictionQueryResponseIncludedItem.RestrictionQueryResponseIncludedItemDeserializer.class) +@JsonSerialize( + using = + RestrictionQueryResponseIncludedItem.RestrictionQueryResponseIncludedItemSerializer.class) +public class RestrictionQueryResponseIncludedItem extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(RestrictionQueryResponseIncludedItem.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class RestrictionQueryResponseIncludedItemSerializer + extends StdSerializer<RestrictionQueryResponseIncludedItem> { + public RestrictionQueryResponseIncludedItemSerializer( + Class<RestrictionQueryResponseIncludedItem> t) { + super(t); + } + + public RestrictionQueryResponseIncludedItemSerializer() { + this(null); + } + + @Override + public void serialize( + RestrictionQueryResponseIncludedItem value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class RestrictionQueryResponseIncludedItemDeserializer + extends StdDeserializer<RestrictionQueryResponseIncludedItem> { + public RestrictionQueryResponseIncludedItemDeserializer() { + this(RestrictionQueryResponseIncludedItem.class); + } + + public RestrictionQueryResponseIncludedItemDeserializer(Class<?> vc) { + super(vc); + } + + @Override + public RestrictionQueryResponseIncludedItem deserialize( + JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize RestrictionQueryRole + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (RestrictionQueryRole.class.equals(Integer.class) + || RestrictionQueryRole.class.equals(Long.class) + || RestrictionQueryRole.class.equals(Float.class) + || RestrictionQueryRole.class.equals(Double.class) + || RestrictionQueryRole.class.equals(Boolean.class) + || RestrictionQueryRole.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((RestrictionQueryRole.class.equals(Integer.class) + || RestrictionQueryRole.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((RestrictionQueryRole.class.equals(Float.class) + || RestrictionQueryRole.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (RestrictionQueryRole.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (RestrictionQueryRole.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(RestrictionQueryRole.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((RestrictionQueryRole) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'RestrictionQueryRole'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'RestrictionQueryRole'", e); + } + + RestrictionQueryResponseIncludedItem ret = new RestrictionQueryResponseIncludedItem(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map<String, Object> res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference<Map<String, Object>>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public RestrictionQueryResponseIncludedItem getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "RestrictionQueryResponseIncludedItem cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map<String, GenericType> schemas = new HashMap<String, GenericType>(); + + public RestrictionQueryResponseIncludedItem() { + super("oneOf", Boolean.FALSE); + } + + public RestrictionQueryResponseIncludedItem(RestrictionQueryRole o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("RestrictionQueryRole", new GenericType<RestrictionQueryRole>() {}); + JSON.registerDescendants( + RestrictionQueryResponseIncludedItem.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map<String, GenericType> getSchemas() { + return RestrictionQueryResponseIncludedItem.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: RestrictionQueryRole + * + * <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(RestrictionQueryRole.class, instance, new HashSet<Class<?>>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet<Class<?>>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be RestrictionQueryRole"); + } + + /** + * Get the actual instance, which can be the following: RestrictionQueryRole + * + * @return The actual instance (RestrictionQueryRole) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `RestrictionQueryRole`. If the actual instance is not + * `RestrictionQueryRole`, the ClassCastException will be thrown. + * + * @return The actual instance of `RestrictionQueryRole` + * @throws ClassCastException if the instance is not `RestrictionQueryRole` + */ + public RestrictionQueryRole getRestrictionQueryRole() throws ClassCastException { + return (RestrictionQueryRole) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryRole.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryRole.java new file mode 100644 index 00000000000..8d25a44c9b7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryRole.java @@ -0,0 +1,183 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Partial role object. */ +@JsonPropertyOrder({ + RestrictionQueryRole.JSON_PROPERTY_ATTRIBUTES, + RestrictionQueryRole.JSON_PROPERTY_ID, + RestrictionQueryRole.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryRole { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private RestrictionQueryRoleAttribute attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "roles"; + + public RestrictionQueryRole attributes(RestrictionQueryRoleAttribute attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the role for a restriction query. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RestrictionQueryRoleAttribute getAttributes() { + return attributes; + } + + public void setAttributes(RestrictionQueryRoleAttribute attributes) { + this.attributes = attributes; + } + + public RestrictionQueryRole id(String id) { + this.id = id; + return this; + } + + /** + * ID of the role. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * Role resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryRole + */ + @JsonAnySetter + public RestrictionQueryRole putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryRole object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryRole restrictionQueryRole = (RestrictionQueryRole) o; + return Objects.equals(this.attributes, restrictionQueryRole.attributes) + && Objects.equals(this.id, restrictionQueryRole.id) + && Objects.equals(this.type, restrictionQueryRole.type) + && Objects.equals(this.additionalProperties, restrictionQueryRole.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryRole {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryRoleAttribute.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryRoleAttribute.java new file mode 100644 index 00000000000..b19ef645d00 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryRoleAttribute.java @@ -0,0 +1,136 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes of the role for a restriction query. */ +@JsonPropertyOrder({RestrictionQueryRoleAttribute.JSON_PROPERTY_NAME}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryRoleAttribute { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public RestrictionQueryRoleAttribute name(String name) { + this.name = name; + return this; + } + + /** + * The role name. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryRoleAttribute + */ + @JsonAnySetter + public RestrictionQueryRoleAttribute putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryRoleAttribute object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryRoleAttribute restrictionQueryRoleAttribute = (RestrictionQueryRoleAttribute) o; + return Objects.equals(this.name, restrictionQueryRoleAttribute.name) + && Objects.equals( + this.additionalProperties, restrictionQueryRoleAttribute.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryRoleAttribute {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryRolesResponse.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryRolesResponse.java new file mode 100644 index 00000000000..ac29d18e711 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryRolesResponse.java @@ -0,0 +1,150 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing information about roles attached to a restriction query. */ +@JsonPropertyOrder({RestrictionQueryRolesResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryRolesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List<RestrictionQueryRole> data = null; + + public RestrictionQueryRolesResponse data(List<RestrictionQueryRole> data) { + this.data = data; + for (RestrictionQueryRole item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public RestrictionQueryRolesResponse addDataItem(RestrictionQueryRole dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array of roles. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<RestrictionQueryRole> getData() { + return data; + } + + public void setData(List<RestrictionQueryRole> data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryRolesResponse + */ + @JsonAnySetter + public RestrictionQueryRolesResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryRolesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryRolesResponse restrictionQueryRolesResponse = (RestrictionQueryRolesResponse) o; + return Objects.equals(this.data, restrictionQueryRolesResponse.data) + && Objects.equals( + this.additionalProperties, restrictionQueryRolesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryRolesResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryUpdateAttributes.java new file mode 100644 index 00000000000..9a984ac1e71 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryUpdateAttributes.java @@ -0,0 +1,137 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes of the edited restriction query. */ +@JsonPropertyOrder({RestrictionQueryUpdateAttributes.JSON_PROPERTY_RESTRICTION_QUERY}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryUpdateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_RESTRICTION_QUERY = "restriction_query"; + private String restrictionQuery; + + public RestrictionQueryUpdateAttributes restrictionQuery(String restrictionQuery) { + this.restrictionQuery = restrictionQuery; + return this; + } + + /** + * The restriction query. + * + * @return restrictionQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESTRICTION_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRestrictionQuery() { + return restrictionQuery; + } + + public void setRestrictionQuery(String restrictionQuery) { + this.restrictionQuery = restrictionQuery; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryUpdateAttributes + */ + @JsonAnySetter + public RestrictionQueryUpdateAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryUpdateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryUpdateAttributes restrictionQueryUpdateAttributes = + (RestrictionQueryUpdateAttributes) o; + return Objects.equals(this.restrictionQuery, restrictionQueryUpdateAttributes.restrictionQuery) + && Objects.equals( + this.additionalProperties, restrictionQueryUpdateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(restrictionQuery, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryUpdateAttributes {\n"); + sb.append(" restrictionQuery: ").append(toIndentedString(restrictionQuery)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryUpdateData.java new file mode 100644 index 00000000000..3ac6378d18f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryUpdateData.java @@ -0,0 +1,170 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data related to the update of a restriction query. */ +@JsonPropertyOrder({ + RestrictionQueryUpdateData.JSON_PROPERTY_ATTRIBUTES, + RestrictionQueryUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private RestrictionQueryUpdateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LogsRestrictionQueriesType type = LogsRestrictionQueriesType.LOGS_RESTRICTION_QUERIES; + + public RestrictionQueryUpdateData attributes(RestrictionQueryUpdateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the edited restriction query. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RestrictionQueryUpdateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(RestrictionQueryUpdateAttributes attributes) { + this.attributes = attributes; + } + + public RestrictionQueryUpdateData type(LogsRestrictionQueriesType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Restriction query resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public LogsRestrictionQueriesType getType() { + return type; + } + + public void setType(LogsRestrictionQueriesType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryUpdateData + */ + @JsonAnySetter + public RestrictionQueryUpdateData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryUpdateData restrictionQueryUpdateData = (RestrictionQueryUpdateData) o; + return Objects.equals(this.attributes, restrictionQueryUpdateData.attributes) + && Objects.equals(this.type, restrictionQueryUpdateData.type) + && Objects.equals( + this.additionalProperties, restrictionQueryUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryUpdateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryUpdatePayload.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryUpdatePayload.java new file mode 100644 index 00000000000..18aa4941f33 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryUpdatePayload.java @@ -0,0 +1,137 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Update a restriction query. */ +@JsonPropertyOrder({RestrictionQueryUpdatePayload.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryUpdatePayload { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private RestrictionQueryUpdateData data; + + public RestrictionQueryUpdatePayload data(RestrictionQueryUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data related to the update of a restriction query. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RestrictionQueryUpdateData getData() { + return data; + } + + public void setData(RestrictionQueryUpdateData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryUpdatePayload + */ + @JsonAnySetter + public RestrictionQueryUpdatePayload putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryUpdatePayload object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryUpdatePayload restrictionQueryUpdatePayload = (RestrictionQueryUpdatePayload) o; + return Objects.equals(this.data, restrictionQueryUpdatePayload.data) + && Objects.equals( + this.additionalProperties, restrictionQueryUpdatePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryUpdatePayload {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryWithRelationships.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryWithRelationships.java new file mode 100644 index 00000000000..389a80bae81 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryWithRelationships.java @@ -0,0 +1,227 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Restriction query object returned by the API. */ +@JsonPropertyOrder({ + RestrictionQueryWithRelationships.JSON_PROPERTY_ATTRIBUTES, + RestrictionQueryWithRelationships.JSON_PROPERTY_ID, + RestrictionQueryWithRelationships.JSON_PROPERTY_RELATIONSHIPS, + RestrictionQueryWithRelationships.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryWithRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private RestrictionQueryAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private RestrictionQueryRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LogsRestrictionQueriesType type = LogsRestrictionQueriesType.LOGS_RESTRICTION_QUERIES; + + public RestrictionQueryWithRelationships attributes(RestrictionQueryAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the restriction query. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RestrictionQueryAttributes getAttributes() { + return attributes; + } + + public void setAttributes(RestrictionQueryAttributes attributes) { + this.attributes = attributes; + } + + public RestrictionQueryWithRelationships id(String id) { + this.id = id; + return this; + } + + /** + * ID of the restriction query. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public RestrictionQueryWithRelationships relationships( + RestrictionQueryRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * Relationships of the restriction query object. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RestrictionQueryRelationships getRelationships() { + return relationships; + } + + public void setRelationships(RestrictionQueryRelationships relationships) { + this.relationships = relationships; + } + + public RestrictionQueryWithRelationships type(LogsRestrictionQueriesType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Restriction query resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public LogsRestrictionQueriesType getType() { + return type; + } + + public void setType(LogsRestrictionQueriesType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryWithRelationships + */ + @JsonAnySetter + public RestrictionQueryWithRelationships putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryWithRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryWithRelationships restrictionQueryWithRelationships = + (RestrictionQueryWithRelationships) o; + return Objects.equals(this.attributes, restrictionQueryWithRelationships.attributes) + && Objects.equals(this.id, restrictionQueryWithRelationships.id) + && Objects.equals(this.relationships, restrictionQueryWithRelationships.relationships) + && Objects.equals(this.type, restrictionQueryWithRelationships.type) + && Objects.equals( + this.additionalProperties, restrictionQueryWithRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryWithRelationships {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryWithRelationshipsResponse.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryWithRelationshipsResponse.java new file mode 100644 index 00000000000..267ae4994e7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryWithRelationshipsResponse.java @@ -0,0 +1,184 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing information about a single restriction query. */ +@JsonPropertyOrder({ + RestrictionQueryWithRelationshipsResponse.JSON_PROPERTY_DATA, + RestrictionQueryWithRelationshipsResponse.JSON_PROPERTY_INCLUDED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryWithRelationshipsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private RestrictionQueryWithRelationships data; + + public static final String JSON_PROPERTY_INCLUDED = "included"; + private List<RestrictionQueryResponseIncludedItem> included = null; + + public RestrictionQueryWithRelationshipsResponse data(RestrictionQueryWithRelationships data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Restriction query object returned by the API. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RestrictionQueryWithRelationships getData() { + return data; + } + + public void setData(RestrictionQueryWithRelationships data) { + this.data = data; + } + + public RestrictionQueryWithRelationshipsResponse included( + List<RestrictionQueryResponseIncludedItem> included) { + this.included = included; + for (RestrictionQueryResponseIncludedItem item : included) { + this.unparsed |= item.unparsed; + } + return this; + } + + public RestrictionQueryWithRelationshipsResponse addIncludedItem( + RestrictionQueryResponseIncludedItem includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + this.unparsed |= includedItem.unparsed; + return this; + } + + /** + * Array of objects related to the restriction query. + * + * @return included + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCLUDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<RestrictionQueryResponseIncludedItem> getIncluded() { + return included; + } + + public void setIncluded(List<RestrictionQueryResponseIncludedItem> included) { + this.included = included; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryWithRelationshipsResponse + */ + @JsonAnySetter + public RestrictionQueryWithRelationshipsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryWithRelationshipsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryWithRelationshipsResponse restrictionQueryWithRelationshipsResponse = + (RestrictionQueryWithRelationshipsResponse) o; + return Objects.equals(this.data, restrictionQueryWithRelationshipsResponse.data) + && Objects.equals(this.included, restrictionQueryWithRelationshipsResponse.included) + && Objects.equals( + this.additionalProperties, + restrictionQueryWithRelationshipsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryWithRelationshipsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryWithoutRelationships.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryWithoutRelationships.java new file mode 100644 index 00000000000..d98f1d119af --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryWithoutRelationships.java @@ -0,0 +1,185 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Restriction query object returned by the API. */ +@JsonPropertyOrder({ + RestrictionQueryWithoutRelationships.JSON_PROPERTY_ATTRIBUTES, + RestrictionQueryWithoutRelationships.JSON_PROPERTY_ID, + RestrictionQueryWithoutRelationships.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryWithoutRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private RestrictionQueryAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "logs_restriction_queries"; + + public RestrictionQueryWithoutRelationships attributes(RestrictionQueryAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the restriction query. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RestrictionQueryAttributes getAttributes() { + return attributes; + } + + public void setAttributes(RestrictionQueryAttributes attributes) { + this.attributes = attributes; + } + + public RestrictionQueryWithoutRelationships id(String id) { + this.id = id; + return this; + } + + /** + * ID of the restriction query. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * Restriction queries type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryWithoutRelationships + */ + @JsonAnySetter + public RestrictionQueryWithoutRelationships putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryWithoutRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryWithoutRelationships restrictionQueryWithoutRelationships = + (RestrictionQueryWithoutRelationships) o; + return Objects.equals(this.attributes, restrictionQueryWithoutRelationships.attributes) + && Objects.equals(this.id, restrictionQueryWithoutRelationships.id) + && Objects.equals(this.type, restrictionQueryWithoutRelationships.type) + && Objects.equals( + this.additionalProperties, restrictionQueryWithoutRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryWithoutRelationships {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryWithoutRelationshipsResponse.java b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryWithoutRelationshipsResponse.java new file mode 100644 index 00000000000..165c78695c7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RestrictionQueryWithoutRelationshipsResponse.java @@ -0,0 +1,141 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response containing information about a single restriction query. */ +@JsonPropertyOrder({RestrictionQueryWithoutRelationshipsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RestrictionQueryWithoutRelationshipsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private RestrictionQueryWithoutRelationships data; + + public RestrictionQueryWithoutRelationshipsResponse data( + RestrictionQueryWithoutRelationships data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Restriction query object returned by the API. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RestrictionQueryWithoutRelationships getData() { + return data; + } + + public void setData(RestrictionQueryWithoutRelationships data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map<String, Object> additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RestrictionQueryWithoutRelationshipsResponse + */ + @JsonAnySetter + public RestrictionQueryWithoutRelationshipsResponse putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<String, Object>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RestrictionQueryWithoutRelationshipsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionQueryWithoutRelationshipsResponse restrictionQueryWithoutRelationshipsResponse = + (RestrictionQueryWithoutRelationshipsResponse) o; + return Objects.equals(this.data, restrictionQueryWithoutRelationshipsResponse.data) + && Objects.equals( + this.additionalProperties, + restrictionQueryWithoutRelationshipsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionQueryWithoutRelationshipsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +}