From 56ef821bf4cf4d6936b0c97c3acc2b550b834b18 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 15 Oct 2026 15:43:53 +0000 Subject: [PATCH] Regenerate client from commit 77698d5 of spec repo --- .generator/schemas/v2/openapi.yaml | 615 ++++++++++++++++++ .../v2/teams/GetTeamHierarchyMembers.java | 38 ++ .../GetTeamHierarchyMembers_1000871040.java | 37 ++ .../GetTeamHierarchyMembers_1140593961.java | 36 + .../GetTeamHierarchyMembers_2494043793.java | 33 + .../GetTeamHierarchyMembers_3103330950.java | 35 + .../GetTeamHierarchyMembers_3197180671.java | 36 + .../GetTeamHierarchyMembers_3330810309.java | 35 + .../GetTeamHierarchyMembers_3355644561.java | 36 + .../GetTeamHierarchyMembers_3685423949.java | 35 + .../GetTeamHierarchyMembers_4101380979.java | 35 + .../GetTeamHierarchyMembers_4182775736.java | 36 + .../com/datadog/api/client/ApiClient.java | 1 + .../datadog/api/client/v2/api/TeamsApi.java | 403 ++++++++++++ .../client/v2/model/TeamHierarchyMember.java | 246 +++++++ .../model/TeamHierarchyMemberAttributes.java | 241 +++++++ .../v2/model/TeamHierarchyMemberIncluded.java | 283 ++++++++ .../TeamHierarchyMemberRelationships.java | 187 ++++++ .../v2/model/TeamHierarchyMemberTeam.java | 210 ++++++ .../TeamHierarchyMemberTeamAttributes.java | 166 +++++ .../v2/model/TeamHierarchyMemberTeamData.java | 180 +++++ .../TeamHierarchyMemberTeamRelationship.java | 150 +++++ .../v2/model/TeamHierarchyMemberTeamType.java | 55 ++ .../v2/model/TeamHierarchyMemberType.java | 57 ++ .../v2/model/TeamHierarchyMemberUser.java | 212 ++++++ .../v2/model/TeamHierarchyMemberUserData.java | 180 +++++ .../TeamHierarchyMemberUserRelationship.java | 150 +++++ .../model/TeamHierarchyMembersNumberPage.java | 367 +++++++++++ .../TeamHierarchyMembersNumberPageType.java | 59 ++ .../model/TeamHierarchyMembersOffsetPage.java | 367 +++++++++++ .../TeamHierarchyMembersOffsetPageType.java | 59 ++ .../v2/model/TeamHierarchyMembersPage.java | 290 +++++++++ .../model/TeamHierarchyMembersResponse.java | 279 ++++++++ .../TeamHierarchyMembersResponseLinks.java | 247 +++++++ .../TeamHierarchyMembersResponseMeta.java | 150 +++++ .../com/datadog/api/client/v2/api/given.json | 44 ++ .../datadog/api/client/v2/api/teams.feature | 265 ++++++++ .../com/datadog/api/client/v2/api/undo.json | 6 + 38 files changed, 5861 insertions(+) create mode 100644 examples/v2/teams/GetTeamHierarchyMembers.java create mode 100644 examples/v2/teams/GetTeamHierarchyMembers_1000871040.java create mode 100644 examples/v2/teams/GetTeamHierarchyMembers_1140593961.java create mode 100644 examples/v2/teams/GetTeamHierarchyMembers_2494043793.java create mode 100644 examples/v2/teams/GetTeamHierarchyMembers_3103330950.java create mode 100644 examples/v2/teams/GetTeamHierarchyMembers_3197180671.java create mode 100644 examples/v2/teams/GetTeamHierarchyMembers_3330810309.java create mode 100644 examples/v2/teams/GetTeamHierarchyMembers_3355644561.java create mode 100644 examples/v2/teams/GetTeamHierarchyMembers_3685423949.java create mode 100644 examples/v2/teams/GetTeamHierarchyMembers_4101380979.java create mode 100644 examples/v2/teams/GetTeamHierarchyMembers_4182775736.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMember.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberIncluded.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberRelationships.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeam.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeamAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeamData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeamRelationship.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeamType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberUser.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberUserData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberUserRelationship.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersNumberPage.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersNumberPageType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersOffsetPage.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersOffsetPageType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersPage.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersResponseLinks.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersResponseMeta.java diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index aa57375c892..3673b7d4025 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -130111,6 +130111,360 @@ components: meta: $ref: "#/components/schemas/TeamsHierarchyLinksResponseMeta" type: object + TeamHierarchyMember: + description: A user relationship to the requested team. + properties: + attributes: + $ref: "#/components/schemas/TeamHierarchyMemberAttributes" + id: + description: Relationship identifier containing the team UUID and user UUID. + example: UserTeamRelationship:692e8073-12c4-4c71-8408-5090bd44c9c8:00000000-0000-0000-0000-000000000001 + type: string + relationships: + $ref: "#/components/schemas/TeamHierarchyMemberRelationships" + type: + $ref: "#/components/schemas/TeamHierarchyMemberType" + required: + - id + - type + - attributes + - relationships + type: object + TeamHierarchyMemberAttributes: + description: Membership attributes relative to the requested team. + properties: + direct_role: + description: "Role on the requested team: admin or member. Null for inherited members." + example: member + nullable: true + pattern: ^(admin|member)$ + type: string + is_direct: + description: Whether the user belongs directly to the requested team. + example: true + type: boolean + provisioned_by: + description: Membership provisioner. Null for inherited members. + example: manual + nullable: true + type: string + provisioned_by_id: + description: Identifier supplied by the membership provisioner. Null when unavailable or for inherited members. + example: + nullable: true + type: string + required: + - is_direct + - direct_role + - provisioned_by + - provisioned_by_id + type: object + TeamHierarchyMemberIncluded: + description: An included user or the requested team, distinguished by resource type. + oneOf: + - $ref: "#/components/schemas/TeamHierarchyMemberUser" + - $ref: "#/components/schemas/TeamHierarchyMemberTeam" + TeamHierarchyMemberRelationships: + description: User and requested team linkage. + properties: + team: + $ref: "#/components/schemas/TeamHierarchyMemberTeamRelationship" + user: + $ref: "#/components/schemas/TeamHierarchyMemberUserRelationship" + required: + - user + - team + type: object + TeamHierarchyMemberTeam: + description: The requested team, included at most once. Descendant teams are not included. + properties: + attributes: + $ref: "#/components/schemas/TeamHierarchyMemberTeamAttributes" + id: + description: UUID of the requested team. + example: 692e8073-12c4-4c71-8408-5090bd44c9c8 + format: uuid + type: string + type: + $ref: "#/components/schemas/TeamHierarchyMemberTeamType" + required: + - id + - type + type: object + TeamHierarchyMemberTeamAttributes: + description: Available attributes of the requested team. + properties: + handle: + description: Handle of the team. + example: platform + type: string + name: + description: Name of the team. + example: Platform + type: string + type: object + TeamHierarchyMemberTeamData: + description: Team resource identifier. + properties: + id: + description: UUID of the team. + example: 692e8073-12c4-4c71-8408-5090bd44c9c8 + format: uuid + type: string + type: + $ref: "#/components/schemas/TeamHierarchyMemberTeamType" + required: + - id + - type + type: object + TeamHierarchyMemberTeamRelationship: + description: Linkage to the requested team. + properties: + data: + $ref: "#/components/schemas/TeamHierarchyMemberTeamData" + required: + - data + type: object + TeamHierarchyMemberTeamType: + default: teams + description: Requested team resource type. + enum: + - teams + example: teams + type: string + x-enum-varnames: + - TEAMS + TeamHierarchyMemberType: + default: user_team_relationship + description: Team hierarchy membership resource type. + enum: + - user_team_relationship + example: user_team_relationship + type: string + x-enum-varnames: + - USER_TEAM_RELATIONSHIP + TeamHierarchyMemberUser: + description: A user included in the hierarchy members response. + properties: + attributes: + $ref: "#/components/schemas/UserAttributes" + id: + description: UUID of the user. + example: 00000000-0000-0000-0000-000000000001 + format: uuid + type: string + type: + $ref: "#/components/schemas/UsersType" + required: + - id + - type + - attributes + type: object + TeamHierarchyMemberUserData: + description: User resource identifier. + properties: + id: + description: UUID of the user. + example: 00000000-0000-0000-0000-000000000001 + format: uuid + type: string + type: + $ref: "#/components/schemas/UsersType" + required: + - id + - type + type: object + TeamHierarchyMemberUserRelationship: + description: Linkage to the user. + properties: + data: + $ref: "#/components/schemas/TeamHierarchyMemberUserData" + required: + - data + type: object + TeamHierarchyMembersNumberPage: + description: Pagination metadata using number and size. + properties: + first_number: + description: First page number. + example: 0 + format: int64 + type: integer + last_number: + description: Last page number. Null when unavailable. + example: 0 + format: int64 + nullable: true + type: integer + next_number: + description: Next page number. Null when unavailable. + example: + format: int64 + nullable: true + type: integer + number: + description: Current zero-based page number. + example: 0 + format: int64 + type: integer + prev_number: + description: Previous page number. Null when unavailable. + example: + format: int64 + nullable: true + type: integer + size: + description: Maximum number of members per page. + example: 100 + format: int64 + type: integer + total: + description: Total number of members matching the filters. + example: 2 + format: int64 + type: integer + type: + $ref: "#/components/schemas/TeamHierarchyMembersNumberPageType" + required: + - type + - number + - size + - total + - first_number + - prev_number + - next_number + - last_number + type: object + TeamHierarchyMembersNumberPageType: + default: number_size + description: Pagination mode. + enum: + - number_size + example: number_size + type: string + x-enum-varnames: + - NUMBER_SIZE + TeamHierarchyMembersOffsetPage: + description: Pagination metadata using offset and limit. + properties: + first_offset: + description: First offset. + example: 0 + format: int64 + type: integer + last_offset: + description: Last offset. Null when unavailable. + example: 0 + format: int64 + nullable: true + type: integer + limit: + description: Maximum number of members per page. + example: 100 + format: int64 + type: integer + next_offset: + description: Next offset. Null when unavailable. + example: + format: int64 + nullable: true + type: integer + offset: + description: Current offset. + example: 0 + format: int64 + type: integer + prev_offset: + description: Previous offset. Null when unavailable. + example: + format: int64 + nullable: true + type: integer + total: + description: Total number of members matching the filters. + example: 2 + format: int64 + type: integer + type: + $ref: "#/components/schemas/TeamHierarchyMembersOffsetPageType" + required: + - type + - offset + - limit + - total + - first_offset + - prev_offset + - next_offset + - last_offset + type: object + TeamHierarchyMembersOffsetPageType: + default: offset_limit + description: Pagination mode. + enum: + - offset_limit + example: offset_limit + type: string + x-enum-varnames: + - OFFSET_LIMIT + TeamHierarchyMembersPage: + description: Pagination metadata for the selected pagination mode. + oneOf: + - $ref: "#/components/schemas/TeamHierarchyMembersOffsetPage" + - $ref: "#/components/schemas/TeamHierarchyMembersNumberPage" + TeamHierarchyMembersResponse: + description: Direct and inherited members of the requested team. + properties: + data: + description: One relationship per user. + items: + $ref: "#/components/schemas/TeamHierarchyMember" + type: array + included: + description: Requested users and the team. May be absent when the result is empty, even if requested. + items: + $ref: "#/components/schemas/TeamHierarchyMemberIncluded" + type: array + links: + $ref: "#/components/schemas/TeamHierarchyMembersResponseLinks" + meta: + $ref: "#/components/schemas/TeamHierarchyMembersResponseMeta" + required: + - data + - meta + - links + type: object + TeamHierarchyMembersResponseLinks: + description: Page navigation links. Unavailable links are omitted. + properties: + first: + description: First page URL. + example: https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100 + type: string + last: + description: Last page URL. + example: https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100 + type: string + next: + description: Next page URL. + example: https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100 + type: string + prev: + description: Previous page URL. + example: https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100 + type: string + self: + description: Current page URL. + example: https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100 + type: string + type: object + TeamHierarchyMembersResponseMeta: + description: Pagination metadata for the filtered members. + properties: + page: + $ref: "#/components/schemas/TeamHierarchyMembersPage" + required: + - page + type: object TeamIncluded: description: Included resources related to the team oneOf: @@ -243616,6 +243970,267 @@ paths: operator: OR permissions: - teams_read + /api/v2/team/{team_id}/members: + get: + description: |- + List the direct and inherited members of a team, deduplicated by user. + Members of descendant teams are included unless `filter[is_direct_only]` is true. + Datadog support users are always excluded. + + Use `page[number]` and `page[size]` to paginate through the results. + Invalid query parameters return a JSON:API error with status 400. + Invalid or unknown team UUIDs return status 404. + operationId: GetTeamHierarchyMembers + parameters: + - description: UUID of the requested root team. + in: path + name: team_id + required: true + schema: + example: 692e8073-12c4-4c71-8408-5090bd44c9c8 + type: string + - description: Return only direct members. By default, members inherited from descendant teams are also returned. + in: query + name: filter[is_direct_only] + required: false + schema: + default: false + example: false + type: boolean + - description: Include service accounts. Datadog support users are always excluded. + in: query + name: filter[include_service_accounts] + required: false + schema: + default: true + example: true + type: boolean + - description: Filter by a case-insensitive substring of the user name, handle, or email. + in: query + name: filter[keyword] + required: false + schema: + example: alice + type: string + - description: "Comma-separated resources to include: `user` and `team`. The included team is the requested team." + in: query + name: include + required: false + schema: + example: user,team + type: string + - description: "Comma-separated sort fields: `name`, `handle`, `is_direct`, and `provisioned_by`. Fields are applied in order, each optionally prefixed with `-` for descending order. By default, team admins come first, followed by other direct members, then inherited members, sorted by name within each group." + in: query + name: sort + required: false + schema: + example: is_direct,-name + type: string + - description: Zero-based page number. Negative values become 0. Defaults to 0. + in: query + name: page[number] + required: false + schema: + default: 0 + example: 0 + format: int64 + type: integer + - description: Members per page, from 1 to 100. Values outside this range use the default of 100. + in: query + name: page[size] + required: false + schema: + default: 100 + example: 100 + format: int64 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + summary: Direct and inherited members with number pagination + value: + data: + - attributes: + direct_role: admin + is_direct: true + provisioned_by: manual + provisioned_by_id: + id: UserTeamRelationship:692e8073-12c4-4c71-8408-5090bd44c9c8:00000000-0000-0000-0000-000000000001 + relationships: + team: + data: + id: 692e8073-12c4-4c71-8408-5090bd44c9c8 + type: teams + user: + data: + id: 00000000-0000-0000-0000-000000000001 + type: users + type: user_team_relationship + - attributes: + direct_role: + is_direct: false + provisioned_by: + provisioned_by_id: + id: UserTeamRelationship:692e8073-12c4-4c71-8408-5090bd44c9c8:00000000-0000-0000-0000-000000000002 + relationships: + team: + data: + id: 692e8073-12c4-4c71-8408-5090bd44c9c8 + type: teams + user: + data: + id: 00000000-0000-0000-0000-000000000002 + type: users + type: user_team_relationship + links: + first: https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100 + last: https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100 + self: https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100 + meta: + page: + first_number: 0 + last_number: 0 + next_number: + number: 0 + prev_number: + size: 100 + total: 2 + type: number_size + empty: + summary: No matching members, with included resources omitted + value: + data: [] + links: + first: https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100 + last: https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100 + self: https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100 + meta: + page: + first_number: 0 + last_number: 0 + next_number: + number: 0 + prev_number: + size: 100 + total: 0 + type: number_size + included_resources: + summary: Users and the team with number pagination + value: + data: + - attributes: + direct_role: admin + is_direct: true + provisioned_by: manual + provisioned_by_id: + id: UserTeamRelationship:692e8073-12c4-4c71-8408-5090bd44c9c8:00000000-0000-0000-0000-000000000001 + relationships: + team: + data: + id: 692e8073-12c4-4c71-8408-5090bd44c9c8 + type: teams + user: + data: + id: 00000000-0000-0000-0000-000000000001 + type: users + type: user_team_relationship + - attributes: + direct_role: + is_direct: false + provisioned_by: + provisioned_by_id: + id: UserTeamRelationship:692e8073-12c4-4c71-8408-5090bd44c9c8:00000000-0000-0000-0000-000000000002 + relationships: + team: + data: + id: 692e8073-12c4-4c71-8408-5090bd44c9c8 + type: teams + user: + data: + id: 00000000-0000-0000-0000-000000000002 + type: users + type: user_team_relationship + included: + - attributes: + email: alice@example.com + handle: alice@example.com + name: Alice + title: + id: 00000000-0000-0000-0000-000000000001 + type: users + - attributes: + email: bob@example.com + handle: bob@example.com + name: + title: + id: 00000000-0000-0000-0000-000000000002 + type: users + - attributes: + handle: platform + name: Platform + id: 692e8073-12c4-4c71-8408-5090bd44c9c8 + type: teams + links: + first: https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?include=user%2Cteam&page%5Bnumber%5D=0&page%5Bsize%5D=100 + last: https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?include=user%2Cteam&page%5Bnumber%5D=0&page%5Bsize%5D=100 + self: https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?include=user%2Cteam&page%5Bnumber%5D=0&page%5Bsize%5D=100 + meta: + page: + first_number: 0 + last_number: 0 + next_number: + number: 0 + prev_number: + size: 100 + total: 2 + type: number_size + schema: + $ref: "#/components/schemas/TeamHierarchyMembersResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Get team hierarchy members + tags: + - Teams + x-pagination: + limitParam: page[size] + pageParam: page[number] + resultsPath: data + x-permission: + operator: OR + permissions: + - teams_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/team/{team_id}/memberships: get: description: Get a paginated list of members for a team diff --git a/examples/v2/teams/GetTeamHierarchyMembers.java b/examples/v2/teams/GetTeamHierarchyMembers.java new file mode 100644 index 00000000000..f4711bf8f5a --- /dev/null +++ b/examples/v2/teams/GetTeamHierarchyMembers.java @@ -0,0 +1,38 @@ +// Get team hierarchy members returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.api.TeamsApi.GetTeamHierarchyMembersOptionalParameters; +import com.datadog.api.client.v2.model.TeamHierarchyMembersResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getTeamHierarchyMembers", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + // there is a valid "user" in the system + String USER_DATA_ATTRIBUTES_EMAIL = System.getenv("USER_DATA_ATTRIBUTES_EMAIL"); + + try { + TeamHierarchyMembersResponse result = + apiInstance.getTeamHierarchyMembers( + DD_TEAM_DATA_ID, + new GetTeamHierarchyMembersOptionalParameters() + .filterKeyword(USER_DATA_ATTRIBUTES_EMAIL) + .include("user,team")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#getTeamHierarchyMembers"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/teams/GetTeamHierarchyMembers_1000871040.java b/examples/v2/teams/GetTeamHierarchyMembers_1000871040.java new file mode 100644 index 00000000000..9049f325628 --- /dev/null +++ b/examples/v2/teams/GetTeamHierarchyMembers_1000871040.java @@ -0,0 +1,37 @@ +// Get team hierarchy members paginates by number and size + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.api.TeamsApi.GetTeamHierarchyMembersOptionalParameters; +import com.datadog.api.client.v2.model.TeamHierarchyMembersResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getTeamHierarchyMembers", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + try { + TeamHierarchyMembersResponse result = + apiInstance.getTeamHierarchyMembers( + DD_TEAM_DATA_ID, + new GetTeamHierarchyMembersOptionalParameters() + .filterKeyword("Example-Team") + .sort("-is_direct") + .pageNumber(1L) + .pageSize(1L)); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#getTeamHierarchyMembers"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/teams/GetTeamHierarchyMembers_1140593961.java b/examples/v2/teams/GetTeamHierarchyMembers_1140593961.java new file mode 100644 index 00000000000..5d0cad27b6d --- /dev/null +++ b/examples/v2/teams/GetTeamHierarchyMembers_1140593961.java @@ -0,0 +1,36 @@ +// Get team hierarchy members normalizes number pagination + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.api.TeamsApi.GetTeamHierarchyMembersOptionalParameters; +import com.datadog.api.client.v2.model.TeamHierarchyMembersResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getTeamHierarchyMembers", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + try { + TeamHierarchyMembersResponse result = + apiInstance.getTeamHierarchyMembers( + DD_TEAM_DATA_ID, + new GetTeamHierarchyMembersOptionalParameters() + .filterKeyword("Example-Team") + .pageNumber(-1L) + .pageSize(101L)); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#getTeamHierarchyMembers"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/teams/GetTeamHierarchyMembers_2494043793.java b/examples/v2/teams/GetTeamHierarchyMembers_2494043793.java new file mode 100644 index 00000000000..a4a46bacc94 --- /dev/null +++ b/examples/v2/teams/GetTeamHierarchyMembers_2494043793.java @@ -0,0 +1,33 @@ +// Get team hierarchy members filters names case insensitively + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.api.TeamsApi.GetTeamHierarchyMembersOptionalParameters; +import com.datadog.api.client.v2.model.TeamHierarchyMembersResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getTeamHierarchyMembers", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + try { + TeamHierarchyMembersResponse result = + apiInstance.getTeamHierarchyMembers( + DD_TEAM_DATA_ID, + new GetTeamHierarchyMembersOptionalParameters().filterKeyword("hIeRaRcHy MeMbEr")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#getTeamHierarchyMembers"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/teams/GetTeamHierarchyMembers_3103330950.java b/examples/v2/teams/GetTeamHierarchyMembers_3103330950.java new file mode 100644 index 00000000000..8ca842b0669 --- /dev/null +++ b/examples/v2/teams/GetTeamHierarchyMembers_3103330950.java @@ -0,0 +1,35 @@ +// Get team hierarchy members returns empty results + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.api.TeamsApi.GetTeamHierarchyMembersOptionalParameters; +import com.datadog.api.client.v2.model.TeamHierarchyMembersResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getTeamHierarchyMembers", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + try { + TeamHierarchyMembersResponse result = + apiInstance.getTeamHierarchyMembers( + DD_TEAM_DATA_ID, + new GetTeamHierarchyMembersOptionalParameters() + .filterKeyword("no-matching-member-Example-Team") + .include("user,team")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#getTeamHierarchyMembers"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/teams/GetTeamHierarchyMembers_3197180671.java b/examples/v2/teams/GetTeamHierarchyMembers_3197180671.java new file mode 100644 index 00000000000..e81e3a11e62 --- /dev/null +++ b/examples/v2/teams/GetTeamHierarchyMembers_3197180671.java @@ -0,0 +1,36 @@ +// Get team hierarchy members deduplicates direct and inherited membership + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.api.TeamsApi.GetTeamHierarchyMembersOptionalParameters; +import com.datadog.api.client.v2.model.TeamHierarchyMembersResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getTeamHierarchyMembers", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + try { + TeamHierarchyMembersResponse result = + apiInstance.getTeamHierarchyMembers( + DD_TEAM_DATA_ID, + new GetTeamHierarchyMembersOptionalParameters() + .filterKeyword("Example-Team") + .sort("-is_direct,handle") + .include("team")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#getTeamHierarchyMembers"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/teams/GetTeamHierarchyMembers_3330810309.java b/examples/v2/teams/GetTeamHierarchyMembers_3330810309.java new file mode 100644 index 00000000000..738dea74e6c --- /dev/null +++ b/examples/v2/teams/GetTeamHierarchyMembers_3330810309.java @@ -0,0 +1,35 @@ +// Get team hierarchy members includes inherited users with null root membership attributes + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.api.TeamsApi.GetTeamHierarchyMembersOptionalParameters; +import com.datadog.api.client.v2.model.TeamHierarchyMembersResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getTeamHierarchyMembers", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + try { + TeamHierarchyMembersResponse result = + apiInstance.getTeamHierarchyMembers( + DD_TEAM_DATA_ID, + new GetTeamHierarchyMembersOptionalParameters() + .filterKeyword("Example-Team") + .include("user,team")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#getTeamHierarchyMembers"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/teams/GetTeamHierarchyMembers_3355644561.java b/examples/v2/teams/GetTeamHierarchyMembers_3355644561.java new file mode 100644 index 00000000000..c9be3390f1d --- /dev/null +++ b/examples/v2/teams/GetTeamHierarchyMembers_3355644561.java @@ -0,0 +1,36 @@ +// Get team hierarchy members filters direct members + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.api.TeamsApi.GetTeamHierarchyMembersOptionalParameters; +import com.datadog.api.client.v2.model.TeamHierarchyMembersResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getTeamHierarchyMembers", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + try { + TeamHierarchyMembersResponse result = + apiInstance.getTeamHierarchyMembers( + DD_TEAM_DATA_ID, + new GetTeamHierarchyMembersOptionalParameters() + .filterKeyword("Example-Team") + .filterIsDirectOnly(true) + .filterIncludeServiceAccounts(false)); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#getTeamHierarchyMembers"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/teams/GetTeamHierarchyMembers_3685423949.java b/examples/v2/teams/GetTeamHierarchyMembers_3685423949.java new file mode 100644 index 00000000000..546a235b6ec --- /dev/null +++ b/examples/v2/teams/GetTeamHierarchyMembers_3685423949.java @@ -0,0 +1,35 @@ +// Get team hierarchy members sorts inherited members before direct members + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.api.TeamsApi.GetTeamHierarchyMembersOptionalParameters; +import com.datadog.api.client.v2.model.TeamHierarchyMembersResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getTeamHierarchyMembers", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + try { + TeamHierarchyMembersResponse result = + apiInstance.getTeamHierarchyMembers( + DD_TEAM_DATA_ID, + new GetTeamHierarchyMembersOptionalParameters() + .filterKeyword("Example-Team") + .sort("is_direct,-name")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#getTeamHierarchyMembers"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/teams/GetTeamHierarchyMembers_4101380979.java b/examples/v2/teams/GetTeamHierarchyMembers_4101380979.java new file mode 100644 index 00000000000..284cae81fe4 --- /dev/null +++ b/examples/v2/teams/GetTeamHierarchyMembers_4101380979.java @@ -0,0 +1,35 @@ +// Get team hierarchy members selects number pagination from page size alone + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.api.TeamsApi.GetTeamHierarchyMembersOptionalParameters; +import com.datadog.api.client.v2.model.TeamHierarchyMembersResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getTeamHierarchyMembers", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + try { + TeamHierarchyMembersResponse result = + apiInstance.getTeamHierarchyMembers( + DD_TEAM_DATA_ID, + new GetTeamHierarchyMembersOptionalParameters() + .filterKeyword("Example-Team") + .pageSize(1L)); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TeamsApi#getTeamHierarchyMembers"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/teams/GetTeamHierarchyMembers_4182775736.java b/examples/v2/teams/GetTeamHierarchyMembers_4182775736.java new file mode 100644 index 00000000000..72e365519da --- /dev/null +++ b/examples/v2/teams/GetTeamHierarchyMembers_4182775736.java @@ -0,0 +1,36 @@ +// Get team hierarchy members returns "OK" response with pagination + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.PaginationIterable; +import com.datadog.api.client.v2.api.TeamsApi; +import com.datadog.api.client.v2.api.TeamsApi.GetTeamHierarchyMembersOptionalParameters; +import com.datadog.api.client.v2.model.TeamHierarchyMember; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getTeamHierarchyMembers", true); + TeamsApi apiInstance = new TeamsApi(defaultClient); + + // there is a valid "dd_team" in the system + String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID"); + + try { + PaginationIterable iterable = + apiInstance.getTeamHierarchyMembersWithPagination( + DD_TEAM_DATA_ID, + new GetTeamHierarchyMembersOptionalParameters() + .filterKeyword("Example-Team") + .pageSize(1L)); + + for (TeamHierarchyMember item : iterable) { + System.out.println(item); + } + } catch (RuntimeException e) { + System.err.println("Exception when calling TeamsApi#getTeamHierarchyMembersWithPagination"); + System.err.println("Reason: " + e.getMessage()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 00eff68c3de..577f138cda2 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1596,6 +1596,7 @@ public class ApiClient { put("v2.updateAiCustomRuleset", false); put("v2.updateCustomRuleset", false); put("v2.addMemberTeam", false); + put("v2.getTeamHierarchyMembers", false); put("v2.listMemberTeams", false); put("v2.removeMemberTeam", false); put("v2.createTimeseriesAnomalyInvestigation", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/TeamsApi.java b/src/main/java/com/datadog/api/client/v2/api/TeamsApi.java index 97a81ffde98..d1a829f2085 100644 --- a/src/main/java/com/datadog/api/client/v2/api/TeamsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/TeamsApi.java @@ -19,6 +19,8 @@ import com.datadog.api.client.v2.model.TeamHierarchyLinkCreateRequest; import com.datadog.api.client.v2.model.TeamHierarchyLinkResponse; import com.datadog.api.client.v2.model.TeamHierarchyLinksResponse; +import com.datadog.api.client.v2.model.TeamHierarchyMember; +import com.datadog.api.client.v2.model.TeamHierarchyMembersResponse; import com.datadog.api.client.v2.model.TeamLinkCreateRequest; import com.datadog.api.client.v2.model.TeamLinkResponse; import com.datadog.api.client.v2.model.TeamLinksResponse; @@ -2141,6 +2143,407 @@ public ApiResponse getTeamHierarchyLinkWithHttpInfo(S new GenericType() {}); } + /** Manage optional parameters to getTeamHierarchyMembers. */ + public static class GetTeamHierarchyMembersOptionalParameters { + private Boolean filterIsDirectOnly; + private Boolean filterIncludeServiceAccounts; + private String filterKeyword; + private String include; + private String sort; + private Long pageNumber; + private Long pageSize; + + /** + * Set filterIsDirectOnly. + * + * @param filterIsDirectOnly Return only direct members. By default, members inherited from + * descendant teams are also returned. (optional, default to false) + * @return GetTeamHierarchyMembersOptionalParameters + */ + public GetTeamHierarchyMembersOptionalParameters filterIsDirectOnly( + Boolean filterIsDirectOnly) { + this.filterIsDirectOnly = filterIsDirectOnly; + return this; + } + + /** + * Set filterIncludeServiceAccounts. + * + * @param filterIncludeServiceAccounts Include service accounts. Datadog support users are + * always excluded. (optional, default to true) + * @return GetTeamHierarchyMembersOptionalParameters + */ + public GetTeamHierarchyMembersOptionalParameters filterIncludeServiceAccounts( + Boolean filterIncludeServiceAccounts) { + this.filterIncludeServiceAccounts = filterIncludeServiceAccounts; + return this; + } + + /** + * Set filterKeyword. + * + * @param filterKeyword Filter by a case-insensitive substring of the user name, handle, or + * email. (optional) + * @return GetTeamHierarchyMembersOptionalParameters + */ + public GetTeamHierarchyMembersOptionalParameters filterKeyword(String filterKeyword) { + this.filterKeyword = filterKeyword; + return this; + } + + /** + * Set include. + * + * @param include Comma-separated resources to include: user and team. + * The included team is the requested team. (optional) + * @return GetTeamHierarchyMembersOptionalParameters + */ + public GetTeamHierarchyMembersOptionalParameters include(String include) { + this.include = include; + return this; + } + + /** + * Set sort. + * + * @param sort Comma-separated sort fields: name, handle, + * is_direct, and provisioned_by. Fields are applied in order, each + * optionally prefixed with - for descending order. By default, team admins + * come first, followed by other direct members, then inherited members, sorted by name + * within each group. (optional) + * @return GetTeamHierarchyMembersOptionalParameters + */ + public GetTeamHierarchyMembersOptionalParameters sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set pageNumber. + * + * @param pageNumber Zero-based page number. Negative values become 0. Defaults to 0. (optional, + * default to 0) + * @return GetTeamHierarchyMembersOptionalParameters + */ + public GetTeamHierarchyMembersOptionalParameters pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * Set pageSize. + * + * @param pageSize Members per page, from 1 to 100. Values outside this range use the default of + * 100. (optional, default to 100) + * @return GetTeamHierarchyMembersOptionalParameters + */ + public GetTeamHierarchyMembersOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + } + + /** + * Get team hierarchy members. + * + *

See {@link #getTeamHierarchyMembersWithHttpInfo}. + * + * @param teamId UUID of the requested root team. (required) + * @return TeamHierarchyMembersResponse + * @throws ApiException if fails to make API call + */ + public TeamHierarchyMembersResponse getTeamHierarchyMembers(String teamId) throws ApiException { + return getTeamHierarchyMembersWithHttpInfo( + teamId, new GetTeamHierarchyMembersOptionalParameters()) + .getData(); + } + + /** + * Get team hierarchy members. + * + *

See {@link #getTeamHierarchyMembersWithHttpInfoAsync}. + * + * @param teamId UUID of the requested root team. (required) + * @return CompletableFuture<TeamHierarchyMembersResponse> + */ + public CompletableFuture getTeamHierarchyMembersAsync( + String teamId) { + return getTeamHierarchyMembersWithHttpInfoAsync( + teamId, new GetTeamHierarchyMembersOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get team hierarchy members. + * + *

See {@link #getTeamHierarchyMembersWithHttpInfo}. + * + * @param teamId UUID of the requested root team. (required) + * @param parameters Optional parameters for the request. + * @return TeamHierarchyMembersResponse + * @throws ApiException if fails to make API call + */ + public TeamHierarchyMembersResponse getTeamHierarchyMembers( + String teamId, GetTeamHierarchyMembersOptionalParameters parameters) throws ApiException { + return getTeamHierarchyMembersWithHttpInfo(teamId, parameters).getData(); + } + + /** + * Get team hierarchy members. + * + *

See {@link #getTeamHierarchyMembersWithHttpInfoAsync}. + * + * @param teamId UUID of the requested root team. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<TeamHierarchyMembersResponse> + */ + public CompletableFuture getTeamHierarchyMembersAsync( + String teamId, GetTeamHierarchyMembersOptionalParameters parameters) { + return getTeamHierarchyMembersWithHttpInfoAsync(teamId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get team hierarchy members. + * + *

See {@link #getTeamHierarchyMembersWithHttpInfo}. + * + * @param teamId UUID of the requested root team. (required) + * @return PaginationIterable<TeamHierarchyMember> + */ + public PaginationIterable getTeamHierarchyMembersWithPagination( + String teamId) { + GetTeamHierarchyMembersOptionalParameters parameters = + new GetTeamHierarchyMembersOptionalParameters(); + return getTeamHierarchyMembersWithPagination(teamId, parameters); + } + + /** + * Get team hierarchy members. + * + *

See {@link #getTeamHierarchyMembersWithHttpInfo}. + * + * @param teamId UUID of the requested root team. (required) + * @return TeamHierarchyMembersResponse + */ + public PaginationIterable getTeamHierarchyMembersWithPagination( + String teamId, GetTeamHierarchyMembersOptionalParameters parameters) { + String resultsPath = "getData"; + String valueGetterPath = ""; + String valueSetterPath = "pageNumber"; + Boolean valueSetterParamOptional = true; + parameters.pageNumber(0l); + Long limit; + + if (parameters.pageSize == null) { + limit = 100l; + parameters.pageSize(limit); + } else { + limit = parameters.pageSize; + } + + LinkedHashMap args = new LinkedHashMap(); + args.put("teamId", teamId); + args.put("optionalParams", parameters); + + PaginationIterable iterator = + new PaginationIterable( + this, + "getTeamHierarchyMembers", + resultsPath, + valueGetterPath, + valueSetterPath, + valueSetterParamOptional, + false, + false, + limit, + args, + 0); + + return iterator; + } + + /** + * List the direct and inherited members of a team, deduplicated by user. Members of descendant + * teams are included unless filter[is_direct_only] is true. Datadog support users + * are always excluded. + * + *

Use page[number] and page[size] to paginate through the results. + * Invalid query parameters return a JSON:API error with status 400. Invalid or unknown team UUIDs + * return status 404. + * + * @param teamId UUID of the requested root team. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<TeamHierarchyMembersResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getTeamHierarchyMembersWithHttpInfo( + String teamId, GetTeamHierarchyMembersOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getTeamHierarchyMembers"; + 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 'teamId' is set + if (teamId == null) { + throw new ApiException( + 400, "Missing the required parameter 'teamId' when calling getTeamHierarchyMembers"); + } + Boolean filterIsDirectOnly = parameters.filterIsDirectOnly; + Boolean filterIncludeServiceAccounts = parameters.filterIncludeServiceAccounts; + String filterKeyword = parameters.filterKeyword; + String include = parameters.include; + String sort = parameters.sort; + Long pageNumber = parameters.pageNumber; + Long pageSize = parameters.pageSize; + // create path and map variables + String localVarPath = + "/api/v2/team/{team_id}/members" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[is_direct_only]", filterIsDirectOnly)); + localVarQueryParams.addAll( + apiClient.parameterToPairs( + "", "filter[include_service_accounts]", filterIncludeServiceAccounts)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[keyword]", filterKeyword)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TeamsApi.getTeamHierarchyMembers", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get team hierarchy members. + * + *

See {@link #getTeamHierarchyMembersWithHttpInfo}. + * + * @param teamId UUID of the requested root team. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<TeamHierarchyMembersResponse>> + */ + public CompletableFuture> + getTeamHierarchyMembersWithHttpInfoAsync( + String teamId, GetTeamHierarchyMembersOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "getTeamHierarchyMembers"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> 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 'teamId' is set + if (teamId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'teamId' when calling getTeamHierarchyMembers")); + return result; + } + Boolean filterIsDirectOnly = parameters.filterIsDirectOnly; + Boolean filterIncludeServiceAccounts = parameters.filterIncludeServiceAccounts; + String filterKeyword = parameters.filterKeyword; + String include = parameters.include; + String sort = parameters.sort; + Long pageNumber = parameters.pageNumber; + Long pageSize = parameters.pageSize; + // create path and map variables + String localVarPath = + "/api/v2/team/{team_id}/members" + .replaceAll("\\{" + "team_id" + "\\}", apiClient.escapeString(teamId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[is_direct_only]", filterIsDirectOnly)); + localVarQueryParams.addAll( + apiClient.parameterToPairs( + "", "filter[include_service_accounts]", filterIncludeServiceAccounts)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[keyword]", filterKeyword)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TeamsApi.getTeamHierarchyMembers", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Get a team link. * diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMember.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMember.java new file mode 100644 index 00000000000..0eb603b7965 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMember.java @@ -0,0 +1,246 @@ +/* + * 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.JsonCreator; +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; + +/** A user relationship to the requested team. */ +@JsonPropertyOrder({ + TeamHierarchyMember.JSON_PROPERTY_ATTRIBUTES, + TeamHierarchyMember.JSON_PROPERTY_ID, + TeamHierarchyMember.JSON_PROPERTY_RELATIONSHIPS, + TeamHierarchyMember.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMember { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TeamHierarchyMemberAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private TeamHierarchyMemberRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TeamHierarchyMemberType type = TeamHierarchyMemberType.USER_TEAM_RELATIONSHIP; + + public TeamHierarchyMember() {} + + @JsonCreator + public TeamHierarchyMember( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + TeamHierarchyMemberAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_RELATIONSHIPS) + TeamHierarchyMemberRelationships relationships, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TeamHierarchyMemberType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TeamHierarchyMember attributes(TeamHierarchyMemberAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Membership attributes relative to the requested team. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamHierarchyMemberAttributes getAttributes() { + return attributes; + } + + public void setAttributes(TeamHierarchyMemberAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public TeamHierarchyMember id(String id) { + this.id = id; + return this; + } + + /** + * Relationship identifier containing the team UUID and user UUID. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public TeamHierarchyMember relationships(TeamHierarchyMemberRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * User and requested team linkage. + * + * @return relationships + */ + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamHierarchyMemberRelationships getRelationships() { + return relationships; + } + + public void setRelationships(TeamHierarchyMemberRelationships relationships) { + this.relationships = relationships; + if (relationships != null) { + this.unparsed |= relationships.unparsed; + } + } + + public TeamHierarchyMember type(TeamHierarchyMemberType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Team hierarchy membership resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamHierarchyMemberType getType() { + return type; + } + + public void setType(TeamHierarchyMemberType 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 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 TeamHierarchyMember + */ + @JsonAnySetter + public TeamHierarchyMember putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMember object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMember teamHierarchyMember = (TeamHierarchyMember) o; + return Objects.equals(this.attributes, teamHierarchyMember.attributes) + && Objects.equals(this.id, teamHierarchyMember.id) + && Objects.equals(this.relationships, teamHierarchyMember.relationships) + && Objects.equals(this.type, teamHierarchyMember.type) + && Objects.equals(this.additionalProperties, teamHierarchyMember.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMember {\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/TeamHierarchyMemberAttributes.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberAttributes.java new file mode 100644 index 00000000000..ab449d9fef4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberAttributes.java @@ -0,0 +1,241 @@ +/* + * 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.JsonCreator; +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; + +/** Membership attributes relative to the requested team. */ +@JsonPropertyOrder({ + TeamHierarchyMemberAttributes.JSON_PROPERTY_DIRECT_ROLE, + TeamHierarchyMemberAttributes.JSON_PROPERTY_IS_DIRECT, + TeamHierarchyMemberAttributes.JSON_PROPERTY_PROVISIONED_BY, + TeamHierarchyMemberAttributes.JSON_PROPERTY_PROVISIONED_BY_ID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMemberAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DIRECT_ROLE = "direct_role"; + private String directRole; + + public static final String JSON_PROPERTY_IS_DIRECT = "is_direct"; + private Boolean isDirect; + + public static final String JSON_PROPERTY_PROVISIONED_BY = "provisioned_by"; + private String provisionedBy; + + public static final String JSON_PROPERTY_PROVISIONED_BY_ID = "provisioned_by_id"; + private String provisionedById; + + public TeamHierarchyMemberAttributes() {} + + @JsonCreator + public TeamHierarchyMemberAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_DIRECT_ROLE) String directRole, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_DIRECT) Boolean isDirect, + @JsonProperty(required = true, value = JSON_PROPERTY_PROVISIONED_BY) String provisionedBy, + @JsonProperty(required = true, value = JSON_PROPERTY_PROVISIONED_BY_ID) + String provisionedById) { + this.directRole = directRole; + if (directRole != null) {} + this.isDirect = isDirect; + this.provisionedBy = provisionedBy; + if (provisionedBy != null) {} + this.provisionedById = provisionedById; + if (provisionedById != null) {} + } + + public TeamHierarchyMemberAttributes directRole(String directRole) { + this.directRole = directRole; + if (directRole != null) {} + return this; + } + + /** + * Role on the requested team: admin or member. Null for inherited members. + * + * @return directRole + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DIRECT_ROLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDirectRole() { + return directRole; + } + + public void setDirectRole(String directRole) { + this.directRole = directRole; + } + + public TeamHierarchyMemberAttributes isDirect(Boolean isDirect) { + this.isDirect = isDirect; + return this; + } + + /** + * Whether the user belongs directly to the requested team. + * + * @return isDirect + */ + @JsonProperty(JSON_PROPERTY_IS_DIRECT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsDirect() { + return isDirect; + } + + public void setIsDirect(Boolean isDirect) { + this.isDirect = isDirect; + } + + public TeamHierarchyMemberAttributes provisionedBy(String provisionedBy) { + this.provisionedBy = provisionedBy; + if (provisionedBy != null) {} + return this; + } + + /** + * Membership provisioner. Null for inherited members. + * + * @return provisionedBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PROVISIONED_BY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getProvisionedBy() { + return provisionedBy; + } + + public void setProvisionedBy(String provisionedBy) { + this.provisionedBy = provisionedBy; + } + + public TeamHierarchyMemberAttributes provisionedById(String provisionedById) { + this.provisionedById = provisionedById; + if (provisionedById != null) {} + return this; + } + + /** + * Identifier supplied by the membership provisioner. Null when unavailable or for inherited + * members. + * + * @return provisionedById + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PROVISIONED_BY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getProvisionedById() { + return provisionedById; + } + + public void setProvisionedById(String provisionedById) { + this.provisionedById = provisionedById; + } + + /** + * 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 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 TeamHierarchyMemberAttributes + */ + @JsonAnySetter + public TeamHierarchyMemberAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMemberAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMemberAttributes teamHierarchyMemberAttributes = (TeamHierarchyMemberAttributes) o; + return Objects.equals(this.directRole, teamHierarchyMemberAttributes.directRole) + && Objects.equals(this.isDirect, teamHierarchyMemberAttributes.isDirect) + && Objects.equals(this.provisionedBy, teamHierarchyMemberAttributes.provisionedBy) + && Objects.equals(this.provisionedById, teamHierarchyMemberAttributes.provisionedById) + && Objects.equals( + this.additionalProperties, teamHierarchyMemberAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(directRole, isDirect, provisionedBy, provisionedById, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMemberAttributes {\n"); + sb.append(" directRole: ").append(toIndentedString(directRole)).append("\n"); + sb.append(" isDirect: ").append(toIndentedString(isDirect)).append("\n"); + sb.append(" provisionedBy: ").append(toIndentedString(provisionedBy)).append("\n"); + sb.append(" provisionedById: ").append(toIndentedString(provisionedById)).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/TeamHierarchyMemberIncluded.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberIncluded.java new file mode 100644 index 00000000000..060db172db6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberIncluded.java @@ -0,0 +1,283 @@ +/* + * 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 = TeamHierarchyMemberIncluded.TeamHierarchyMemberIncludedDeserializer.class) +@JsonSerialize(using = TeamHierarchyMemberIncluded.TeamHierarchyMemberIncludedSerializer.class) +public class TeamHierarchyMemberIncluded extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(TeamHierarchyMemberIncluded.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class TeamHierarchyMemberIncludedSerializer + extends StdSerializer { + public TeamHierarchyMemberIncludedSerializer(Class t) { + super(t); + } + + public TeamHierarchyMemberIncludedSerializer() { + this(null); + } + + @Override + public void serialize( + TeamHierarchyMemberIncluded value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class TeamHierarchyMemberIncludedDeserializer + extends StdDeserializer { + public TeamHierarchyMemberIncludedDeserializer() { + this(TeamHierarchyMemberIncluded.class); + } + + public TeamHierarchyMemberIncludedDeserializer(Class vc) { + super(vc); + } + + @Override + public TeamHierarchyMemberIncluded 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 TeamHierarchyMemberUser + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (TeamHierarchyMemberUser.class.equals(Integer.class) + || TeamHierarchyMemberUser.class.equals(Long.class) + || TeamHierarchyMemberUser.class.equals(Float.class) + || TeamHierarchyMemberUser.class.equals(Double.class) + || TeamHierarchyMemberUser.class.equals(Boolean.class) + || TeamHierarchyMemberUser.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((TeamHierarchyMemberUser.class.equals(Integer.class) + || TeamHierarchyMemberUser.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((TeamHierarchyMemberUser.class.equals(Float.class) + || TeamHierarchyMemberUser.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (TeamHierarchyMemberUser.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (TeamHierarchyMemberUser.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(TeamHierarchyMemberUser.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 (!((TeamHierarchyMemberUser) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'TeamHierarchyMemberUser'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'TeamHierarchyMemberUser'", e); + } + + // deserialize TeamHierarchyMemberTeam + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (TeamHierarchyMemberTeam.class.equals(Integer.class) + || TeamHierarchyMemberTeam.class.equals(Long.class) + || TeamHierarchyMemberTeam.class.equals(Float.class) + || TeamHierarchyMemberTeam.class.equals(Double.class) + || TeamHierarchyMemberTeam.class.equals(Boolean.class) + || TeamHierarchyMemberTeam.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((TeamHierarchyMemberTeam.class.equals(Integer.class) + || TeamHierarchyMemberTeam.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((TeamHierarchyMemberTeam.class.equals(Float.class) + || TeamHierarchyMemberTeam.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (TeamHierarchyMemberTeam.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (TeamHierarchyMemberTeam.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(TeamHierarchyMemberTeam.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 (!((TeamHierarchyMemberTeam) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'TeamHierarchyMemberTeam'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'TeamHierarchyMemberTeam'", e); + } + + TeamHierarchyMemberIncluded ret = new TeamHierarchyMemberIncluded(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public TeamHierarchyMemberIncluded getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "TeamHierarchyMemberIncluded cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public TeamHierarchyMemberIncluded() { + super("oneOf", Boolean.FALSE); + } + + public TeamHierarchyMemberIncluded(TeamHierarchyMemberUser o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public TeamHierarchyMemberIncluded(TeamHierarchyMemberTeam o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("TeamHierarchyMemberUser", new GenericType() {}); + schemas.put("TeamHierarchyMemberTeam", new GenericType() {}); + JSON.registerDescendants( + TeamHierarchyMemberIncluded.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return TeamHierarchyMemberIncluded.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: TeamHierarchyMemberUser, TeamHierarchyMemberTeam + * + *

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(TeamHierarchyMemberUser.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(TeamHierarchyMemberTeam.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be TeamHierarchyMemberUser, TeamHierarchyMemberTeam"); + } + + /** + * Get the actual instance, which can be the following: TeamHierarchyMemberUser, + * TeamHierarchyMemberTeam + * + * @return The actual instance (TeamHierarchyMemberUser, TeamHierarchyMemberTeam) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `TeamHierarchyMemberUser`. If the actual instance is not + * `TeamHierarchyMemberUser`, the ClassCastException will be thrown. + * + * @return The actual instance of `TeamHierarchyMemberUser` + * @throws ClassCastException if the instance is not `TeamHierarchyMemberUser` + */ + public TeamHierarchyMemberUser getTeamHierarchyMemberUser() throws ClassCastException { + return (TeamHierarchyMemberUser) super.getActualInstance(); + } + + /** + * Get the actual instance of `TeamHierarchyMemberTeam`. If the actual instance is not + * `TeamHierarchyMemberTeam`, the ClassCastException will be thrown. + * + * @return The actual instance of `TeamHierarchyMemberTeam` + * @throws ClassCastException if the instance is not `TeamHierarchyMemberTeam` + */ + public TeamHierarchyMemberTeam getTeamHierarchyMemberTeam() throws ClassCastException { + return (TeamHierarchyMemberTeam) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberRelationships.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberRelationships.java new file mode 100644 index 00000000000..cbfffd88112 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberRelationships.java @@ -0,0 +1,187 @@ +/* + * 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.JsonCreator; +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; + +/** User and requested team linkage. */ +@JsonPropertyOrder({ + TeamHierarchyMemberRelationships.JSON_PROPERTY_TEAM, + TeamHierarchyMemberRelationships.JSON_PROPERTY_USER +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMemberRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TEAM = "team"; + private TeamHierarchyMemberTeamRelationship team; + + public static final String JSON_PROPERTY_USER = "user"; + private TeamHierarchyMemberUserRelationship user; + + public TeamHierarchyMemberRelationships() {} + + @JsonCreator + public TeamHierarchyMemberRelationships( + @JsonProperty(required = true, value = JSON_PROPERTY_TEAM) + TeamHierarchyMemberTeamRelationship team, + @JsonProperty(required = true, value = JSON_PROPERTY_USER) + TeamHierarchyMemberUserRelationship user) { + this.team = team; + this.unparsed |= team.unparsed; + this.user = user; + this.unparsed |= user.unparsed; + } + + public TeamHierarchyMemberRelationships team(TeamHierarchyMemberTeamRelationship team) { + this.team = team; + this.unparsed |= team.unparsed; + return this; + } + + /** + * Linkage to the requested team. + * + * @return team + */ + @JsonProperty(JSON_PROPERTY_TEAM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamHierarchyMemberTeamRelationship getTeam() { + return team; + } + + public void setTeam(TeamHierarchyMemberTeamRelationship team) { + this.team = team; + if (team != null) { + this.unparsed |= team.unparsed; + } + } + + public TeamHierarchyMemberRelationships user(TeamHierarchyMemberUserRelationship user) { + this.user = user; + this.unparsed |= user.unparsed; + return this; + } + + /** + * Linkage to the user. + * + * @return user + */ + @JsonProperty(JSON_PROPERTY_USER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamHierarchyMemberUserRelationship getUser() { + return user; + } + + public void setUser(TeamHierarchyMemberUserRelationship user) { + this.user = user; + if (user != null) { + this.unparsed |= user.unparsed; + } + } + + /** + * 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 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 TeamHierarchyMemberRelationships + */ + @JsonAnySetter + public TeamHierarchyMemberRelationships putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMemberRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMemberRelationships teamHierarchyMemberRelationships = + (TeamHierarchyMemberRelationships) o; + return Objects.equals(this.team, teamHierarchyMemberRelationships.team) + && Objects.equals(this.user, teamHierarchyMemberRelationships.user) + && Objects.equals( + this.additionalProperties, teamHierarchyMemberRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(team, user, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMemberRelationships {\n"); + sb.append(" team: ").append(toIndentedString(team)).append("\n"); + sb.append(" user: ").append(toIndentedString(user)).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/TeamHierarchyMemberTeam.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeam.java new file mode 100644 index 00000000000..fa3a6c207eb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeam.java @@ -0,0 +1,210 @@ +/* + * 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.JsonCreator; +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; +import java.util.UUID; + +/** The requested team, included at most once. Descendant teams are not included. */ +@JsonPropertyOrder({ + TeamHierarchyMemberTeam.JSON_PROPERTY_ATTRIBUTES, + TeamHierarchyMemberTeam.JSON_PROPERTY_ID, + TeamHierarchyMemberTeam.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMemberTeam { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TeamHierarchyMemberTeamAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TeamHierarchyMemberTeamType type = TeamHierarchyMemberTeamType.TEAMS; + + public TeamHierarchyMemberTeam() {} + + @JsonCreator + public TeamHierarchyMemberTeam( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TeamHierarchyMemberTeamType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TeamHierarchyMemberTeam attributes(TeamHierarchyMemberTeamAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Available attributes of the requested team. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TeamHierarchyMemberTeamAttributes getAttributes() { + return attributes; + } + + public void setAttributes(TeamHierarchyMemberTeamAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public TeamHierarchyMemberTeam id(UUID id) { + this.id = id; + return this; + } + + /** + * UUID of the requested team. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public TeamHierarchyMemberTeam type(TeamHierarchyMemberTeamType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Requested team resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamHierarchyMemberTeamType getType() { + return type; + } + + public void setType(TeamHierarchyMemberTeamType 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 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 TeamHierarchyMemberTeam + */ + @JsonAnySetter + public TeamHierarchyMemberTeam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMemberTeam object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMemberTeam teamHierarchyMemberTeam = (TeamHierarchyMemberTeam) o; + return Objects.equals(this.attributes, teamHierarchyMemberTeam.attributes) + && Objects.equals(this.id, teamHierarchyMemberTeam.id) + && Objects.equals(this.type, teamHierarchyMemberTeam.type) + && Objects.equals(this.additionalProperties, teamHierarchyMemberTeam.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMemberTeam {\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/TeamHierarchyMemberTeamAttributes.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeamAttributes.java new file mode 100644 index 00000000000..3ac382d0fe4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeamAttributes.java @@ -0,0 +1,166 @@ +/* + * 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; + +/** Available attributes of the requested team. */ +@JsonPropertyOrder({ + TeamHierarchyMemberTeamAttributes.JSON_PROPERTY_HANDLE, + TeamHierarchyMemberTeamAttributes.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMemberTeamAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_HANDLE = "handle"; + private String handle; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public TeamHierarchyMemberTeamAttributes handle(String handle) { + this.handle = handle; + return this; + } + + /** + * Handle of the team. + * + * @return handle + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HANDLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getHandle() { + return handle; + } + + public void setHandle(String handle) { + this.handle = handle; + } + + public TeamHierarchyMemberTeamAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Name of the team. + * + * @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 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 TeamHierarchyMemberTeamAttributes + */ + @JsonAnySetter + public TeamHierarchyMemberTeamAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMemberTeamAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMemberTeamAttributes teamHierarchyMemberTeamAttributes = + (TeamHierarchyMemberTeamAttributes) o; + return Objects.equals(this.handle, teamHierarchyMemberTeamAttributes.handle) + && Objects.equals(this.name, teamHierarchyMemberTeamAttributes.name) + && Objects.equals( + this.additionalProperties, teamHierarchyMemberTeamAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(handle, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMemberTeamAttributes {\n"); + sb.append(" handle: ").append(toIndentedString(handle)).append("\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/TeamHierarchyMemberTeamData.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeamData.java new file mode 100644 index 00000000000..61dc920226c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeamData.java @@ -0,0 +1,180 @@ +/* + * 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.JsonCreator; +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; +import java.util.UUID; + +/** Team resource identifier. */ +@JsonPropertyOrder({ + TeamHierarchyMemberTeamData.JSON_PROPERTY_ID, + TeamHierarchyMemberTeamData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMemberTeamData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TeamHierarchyMemberTeamType type = TeamHierarchyMemberTeamType.TEAMS; + + public TeamHierarchyMemberTeamData() {} + + @JsonCreator + public TeamHierarchyMemberTeamData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TeamHierarchyMemberTeamType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TeamHierarchyMemberTeamData id(UUID id) { + this.id = id; + return this; + } + + /** + * UUID of the team. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public TeamHierarchyMemberTeamData type(TeamHierarchyMemberTeamType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Requested team resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamHierarchyMemberTeamType getType() { + return type; + } + + public void setType(TeamHierarchyMemberTeamType 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 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 TeamHierarchyMemberTeamData + */ + @JsonAnySetter + public TeamHierarchyMemberTeamData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMemberTeamData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMemberTeamData teamHierarchyMemberTeamData = (TeamHierarchyMemberTeamData) o; + return Objects.equals(this.id, teamHierarchyMemberTeamData.id) + && Objects.equals(this.type, teamHierarchyMemberTeamData.type) + && Objects.equals( + this.additionalProperties, teamHierarchyMemberTeamData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMemberTeamData {\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/TeamHierarchyMemberTeamRelationship.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeamRelationship.java new file mode 100644 index 00000000000..1a2c3182572 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeamRelationship.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.JsonCreator; +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; + +/** Linkage to the requested team. */ +@JsonPropertyOrder({TeamHierarchyMemberTeamRelationship.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMemberTeamRelationship { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TeamHierarchyMemberTeamData data; + + public TeamHierarchyMemberTeamRelationship() {} + + @JsonCreator + public TeamHierarchyMemberTeamRelationship( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) TeamHierarchyMemberTeamData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public TeamHierarchyMemberTeamRelationship data(TeamHierarchyMemberTeamData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Team resource identifier. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamHierarchyMemberTeamData getData() { + return data; + } + + public void setData(TeamHierarchyMemberTeamData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 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 TeamHierarchyMemberTeamRelationship + */ + @JsonAnySetter + public TeamHierarchyMemberTeamRelationship putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMemberTeamRelationship object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMemberTeamRelationship teamHierarchyMemberTeamRelationship = + (TeamHierarchyMemberTeamRelationship) o; + return Objects.equals(this.data, teamHierarchyMemberTeamRelationship.data) + && Objects.equals( + this.additionalProperties, teamHierarchyMemberTeamRelationship.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMemberTeamRelationship {\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/TeamHierarchyMemberTeamType.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeamType.java new file mode 100644 index 00000000000..d5d5ad822eb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberTeamType.java @@ -0,0 +1,55 @@ +/* + * 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; + +/** Requested team resource type. */ +@JsonSerialize(using = TeamHierarchyMemberTeamType.TeamHierarchyMemberTeamTypeSerializer.class) +public class TeamHierarchyMemberTeamType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("teams")); + + public static final TeamHierarchyMemberTeamType TEAMS = new TeamHierarchyMemberTeamType("teams"); + + TeamHierarchyMemberTeamType(String value) { + super(value, allowedValues); + } + + public static class TeamHierarchyMemberTeamTypeSerializer + extends StdSerializer { + public TeamHierarchyMemberTeamTypeSerializer(Class t) { + super(t); + } + + public TeamHierarchyMemberTeamTypeSerializer() { + this(null); + } + + @Override + public void serialize( + TeamHierarchyMemberTeamType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TeamHierarchyMemberTeamType fromValue(String value) { + return new TeamHierarchyMemberTeamType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberType.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberType.java new file mode 100644 index 00000000000..a19980a289d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberType.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; + +/** Team hierarchy membership resource type. */ +@JsonSerialize(using = TeamHierarchyMemberType.TeamHierarchyMemberTypeSerializer.class) +public class TeamHierarchyMemberType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("user_team_relationship")); + + public static final TeamHierarchyMemberType USER_TEAM_RELATIONSHIP = + new TeamHierarchyMemberType("user_team_relationship"); + + TeamHierarchyMemberType(String value) { + super(value, allowedValues); + } + + public static class TeamHierarchyMemberTypeSerializer + extends StdSerializer { + public TeamHierarchyMemberTypeSerializer(Class t) { + super(t); + } + + public TeamHierarchyMemberTypeSerializer() { + this(null); + } + + @Override + public void serialize( + TeamHierarchyMemberType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TeamHierarchyMemberType fromValue(String value) { + return new TeamHierarchyMemberType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberUser.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberUser.java new file mode 100644 index 00000000000..ab2b1ec9898 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberUser.java @@ -0,0 +1,212 @@ +/* + * 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.JsonCreator; +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; +import java.util.UUID; + +/** A user included in the hierarchy members response. */ +@JsonPropertyOrder({ + TeamHierarchyMemberUser.JSON_PROPERTY_ATTRIBUTES, + TeamHierarchyMemberUser.JSON_PROPERTY_ID, + TeamHierarchyMemberUser.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMemberUser { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UserAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private UsersType type = UsersType.USERS; + + public TeamHierarchyMemberUser() {} + + @JsonCreator + public TeamHierarchyMemberUser( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) UserAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) UsersType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TeamHierarchyMemberUser attributes(UserAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of user object returned by the API. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UserAttributes getAttributes() { + return attributes; + } + + public void setAttributes(UserAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public TeamHierarchyMemberUser id(UUID id) { + this.id = id; + return this; + } + + /** + * UUID of the user. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public TeamHierarchyMemberUser type(UsersType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Users resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UsersType getType() { + return type; + } + + public void setType(UsersType 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 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 TeamHierarchyMemberUser + */ + @JsonAnySetter + public TeamHierarchyMemberUser putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMemberUser object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMemberUser teamHierarchyMemberUser = (TeamHierarchyMemberUser) o; + return Objects.equals(this.attributes, teamHierarchyMemberUser.attributes) + && Objects.equals(this.id, teamHierarchyMemberUser.id) + && Objects.equals(this.type, teamHierarchyMemberUser.type) + && Objects.equals(this.additionalProperties, teamHierarchyMemberUser.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMemberUser {\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/TeamHierarchyMemberUserData.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberUserData.java new file mode 100644 index 00000000000..d73c0e69aef --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberUserData.java @@ -0,0 +1,180 @@ +/* + * 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.JsonCreator; +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; +import java.util.UUID; + +/** User resource identifier. */ +@JsonPropertyOrder({ + TeamHierarchyMemberUserData.JSON_PROPERTY_ID, + TeamHierarchyMemberUserData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMemberUserData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private UsersType type = UsersType.USERS; + + public TeamHierarchyMemberUserData() {} + + @JsonCreator + public TeamHierarchyMemberUserData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) UsersType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TeamHierarchyMemberUserData id(UUID id) { + this.id = id; + return this; + } + + /** + * UUID of the user. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public TeamHierarchyMemberUserData type(UsersType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Users resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UsersType getType() { + return type; + } + + public void setType(UsersType 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 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 TeamHierarchyMemberUserData + */ + @JsonAnySetter + public TeamHierarchyMemberUserData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMemberUserData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMemberUserData teamHierarchyMemberUserData = (TeamHierarchyMemberUserData) o; + return Objects.equals(this.id, teamHierarchyMemberUserData.id) + && Objects.equals(this.type, teamHierarchyMemberUserData.type) + && Objects.equals( + this.additionalProperties, teamHierarchyMemberUserData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMemberUserData {\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/TeamHierarchyMemberUserRelationship.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberUserRelationship.java new file mode 100644 index 00000000000..c9ebbe80242 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMemberUserRelationship.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.JsonCreator; +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; + +/** Linkage to the user. */ +@JsonPropertyOrder({TeamHierarchyMemberUserRelationship.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMemberUserRelationship { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TeamHierarchyMemberUserData data; + + public TeamHierarchyMemberUserRelationship() {} + + @JsonCreator + public TeamHierarchyMemberUserRelationship( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) TeamHierarchyMemberUserData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public TeamHierarchyMemberUserRelationship data(TeamHierarchyMemberUserData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * User resource identifier. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamHierarchyMemberUserData getData() { + return data; + } + + public void setData(TeamHierarchyMemberUserData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 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 TeamHierarchyMemberUserRelationship + */ + @JsonAnySetter + public TeamHierarchyMemberUserRelationship putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMemberUserRelationship object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMemberUserRelationship teamHierarchyMemberUserRelationship = + (TeamHierarchyMemberUserRelationship) o; + return Objects.equals(this.data, teamHierarchyMemberUserRelationship.data) + && Objects.equals( + this.additionalProperties, teamHierarchyMemberUserRelationship.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMemberUserRelationship {\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/TeamHierarchyMembersNumberPage.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersNumberPage.java new file mode 100644 index 00000000000..92c9c356f9c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersNumberPage.java @@ -0,0 +1,367 @@ +/* + * 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.JsonCreator; +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; + +/** Pagination metadata using number and size. */ +@JsonPropertyOrder({ + TeamHierarchyMembersNumberPage.JSON_PROPERTY_FIRST_NUMBER, + TeamHierarchyMembersNumberPage.JSON_PROPERTY_LAST_NUMBER, + TeamHierarchyMembersNumberPage.JSON_PROPERTY_NEXT_NUMBER, + TeamHierarchyMembersNumberPage.JSON_PROPERTY_NUMBER, + TeamHierarchyMembersNumberPage.JSON_PROPERTY_PREV_NUMBER, + TeamHierarchyMembersNumberPage.JSON_PROPERTY_SIZE, + TeamHierarchyMembersNumberPage.JSON_PROPERTY_TOTAL, + TeamHierarchyMembersNumberPage.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMembersNumberPage { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FIRST_NUMBER = "first_number"; + private Long firstNumber; + + public static final String JSON_PROPERTY_LAST_NUMBER = "last_number"; + private Long lastNumber; + + public static final String JSON_PROPERTY_NEXT_NUMBER = "next_number"; + private Long nextNumber; + + public static final String JSON_PROPERTY_NUMBER = "number"; + private Long number; + + public static final String JSON_PROPERTY_PREV_NUMBER = "prev_number"; + private Long prevNumber; + + public static final String JSON_PROPERTY_SIZE = "size"; + private Long size; + + public static final String JSON_PROPERTY_TOTAL = "total"; + private Long total; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TeamHierarchyMembersNumberPageType type = TeamHierarchyMembersNumberPageType.NUMBER_SIZE; + + public TeamHierarchyMembersNumberPage() {} + + @JsonCreator + public TeamHierarchyMembersNumberPage( + @JsonProperty(required = true, value = JSON_PROPERTY_FIRST_NUMBER) Long firstNumber, + @JsonProperty(required = true, value = JSON_PROPERTY_LAST_NUMBER) Long lastNumber, + @JsonProperty(required = true, value = JSON_PROPERTY_NEXT_NUMBER) Long nextNumber, + @JsonProperty(required = true, value = JSON_PROPERTY_NUMBER) Long number, + @JsonProperty(required = true, value = JSON_PROPERTY_PREV_NUMBER) Long prevNumber, + @JsonProperty(required = true, value = JSON_PROPERTY_SIZE) Long size, + @JsonProperty(required = true, value = JSON_PROPERTY_TOTAL) Long total, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + TeamHierarchyMembersNumberPageType type) { + this.firstNumber = firstNumber; + this.lastNumber = lastNumber; + if (lastNumber != null) {} + this.nextNumber = nextNumber; + if (nextNumber != null) {} + this.number = number; + this.prevNumber = prevNumber; + if (prevNumber != null) {} + this.size = size; + this.total = total; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TeamHierarchyMembersNumberPage firstNumber(Long firstNumber) { + this.firstNumber = firstNumber; + return this; + } + + /** + * First page number. + * + * @return firstNumber + */ + @JsonProperty(JSON_PROPERTY_FIRST_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getFirstNumber() { + return firstNumber; + } + + public void setFirstNumber(Long firstNumber) { + this.firstNumber = firstNumber; + } + + public TeamHierarchyMembersNumberPage lastNumber(Long lastNumber) { + this.lastNumber = lastNumber; + if (lastNumber != null) {} + return this; + } + + /** + * Last page number. Null when unavailable. + * + * @return lastNumber + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getLastNumber() { + return lastNumber; + } + + public void setLastNumber(Long lastNumber) { + this.lastNumber = lastNumber; + } + + public TeamHierarchyMembersNumberPage nextNumber(Long nextNumber) { + this.nextNumber = nextNumber; + if (nextNumber != null) {} + return this; + } + + /** + * Next page number. Null when unavailable. + * + * @return nextNumber + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NEXT_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getNextNumber() { + return nextNumber; + } + + public void setNextNumber(Long nextNumber) { + this.nextNumber = nextNumber; + } + + public TeamHierarchyMembersNumberPage number(Long number) { + this.number = number; + return this; + } + + /** + * Current zero-based page number. + * + * @return number + */ + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getNumber() { + return number; + } + + public void setNumber(Long number) { + this.number = number; + } + + public TeamHierarchyMembersNumberPage prevNumber(Long prevNumber) { + this.prevNumber = prevNumber; + if (prevNumber != null) {} + return this; + } + + /** + * Previous page number. Null when unavailable. + * + * @return prevNumber + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PREV_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getPrevNumber() { + return prevNumber; + } + + public void setPrevNumber(Long prevNumber) { + this.prevNumber = prevNumber; + } + + public TeamHierarchyMembersNumberPage size(Long size) { + this.size = size; + return this; + } + + /** + * Maximum number of members per page. + * + * @return size + */ + @JsonProperty(JSON_PROPERTY_SIZE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getSize() { + return size; + } + + public void setSize(Long size) { + this.size = size; + } + + public TeamHierarchyMembersNumberPage total(Long total) { + this.total = total; + return this; + } + + /** + * Total number of members matching the filters. + * + * @return total + */ + @JsonProperty(JSON_PROPERTY_TOTAL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + + public TeamHierarchyMembersNumberPage type(TeamHierarchyMembersNumberPageType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Pagination mode. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamHierarchyMembersNumberPageType getType() { + return type; + } + + public void setType(TeamHierarchyMembersNumberPageType 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 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 TeamHierarchyMembersNumberPage + */ + @JsonAnySetter + public TeamHierarchyMembersNumberPage putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMembersNumberPage object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMembersNumberPage teamHierarchyMembersNumberPage = + (TeamHierarchyMembersNumberPage) o; + return Objects.equals(this.firstNumber, teamHierarchyMembersNumberPage.firstNumber) + && Objects.equals(this.lastNumber, teamHierarchyMembersNumberPage.lastNumber) + && Objects.equals(this.nextNumber, teamHierarchyMembersNumberPage.nextNumber) + && Objects.equals(this.number, teamHierarchyMembersNumberPage.number) + && Objects.equals(this.prevNumber, teamHierarchyMembersNumberPage.prevNumber) + && Objects.equals(this.size, teamHierarchyMembersNumberPage.size) + && Objects.equals(this.total, teamHierarchyMembersNumberPage.total) + && Objects.equals(this.type, teamHierarchyMembersNumberPage.type) + && Objects.equals( + this.additionalProperties, teamHierarchyMembersNumberPage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + firstNumber, + lastNumber, + nextNumber, + number, + prevNumber, + size, + total, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMembersNumberPage {\n"); + sb.append(" firstNumber: ").append(toIndentedString(firstNumber)).append("\n"); + sb.append(" lastNumber: ").append(toIndentedString(lastNumber)).append("\n"); + sb.append(" nextNumber: ").append(toIndentedString(nextNumber)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" prevNumber: ").append(toIndentedString(prevNumber)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).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/TeamHierarchyMembersNumberPageType.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersNumberPageType.java new file mode 100644 index 00000000000..9c57a4b443c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersNumberPageType.java @@ -0,0 +1,59 @@ +/* + * 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; + +/** Pagination mode. */ +@JsonSerialize( + using = TeamHierarchyMembersNumberPageType.TeamHierarchyMembersNumberPageTypeSerializer.class) +public class TeamHierarchyMembersNumberPageType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("number_size")); + + public static final TeamHierarchyMembersNumberPageType NUMBER_SIZE = + new TeamHierarchyMembersNumberPageType("number_size"); + + TeamHierarchyMembersNumberPageType(String value) { + super(value, allowedValues); + } + + public static class TeamHierarchyMembersNumberPageTypeSerializer + extends StdSerializer { + public TeamHierarchyMembersNumberPageTypeSerializer( + Class t) { + super(t); + } + + public TeamHierarchyMembersNumberPageTypeSerializer() { + this(null); + } + + @Override + public void serialize( + TeamHierarchyMembersNumberPageType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TeamHierarchyMembersNumberPageType fromValue(String value) { + return new TeamHierarchyMembersNumberPageType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersOffsetPage.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersOffsetPage.java new file mode 100644 index 00000000000..e6e7b9365ca --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersOffsetPage.java @@ -0,0 +1,367 @@ +/* + * 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.JsonCreator; +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; + +/** Pagination metadata using offset and limit. */ +@JsonPropertyOrder({ + TeamHierarchyMembersOffsetPage.JSON_PROPERTY_FIRST_OFFSET, + TeamHierarchyMembersOffsetPage.JSON_PROPERTY_LAST_OFFSET, + TeamHierarchyMembersOffsetPage.JSON_PROPERTY_LIMIT, + TeamHierarchyMembersOffsetPage.JSON_PROPERTY_NEXT_OFFSET, + TeamHierarchyMembersOffsetPage.JSON_PROPERTY_OFFSET, + TeamHierarchyMembersOffsetPage.JSON_PROPERTY_PREV_OFFSET, + TeamHierarchyMembersOffsetPage.JSON_PROPERTY_TOTAL, + TeamHierarchyMembersOffsetPage.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMembersOffsetPage { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FIRST_OFFSET = "first_offset"; + private Long firstOffset; + + public static final String JSON_PROPERTY_LAST_OFFSET = "last_offset"; + private Long lastOffset; + + public static final String JSON_PROPERTY_LIMIT = "limit"; + private Long limit; + + public static final String JSON_PROPERTY_NEXT_OFFSET = "next_offset"; + private Long nextOffset; + + public static final String JSON_PROPERTY_OFFSET = "offset"; + private Long offset; + + public static final String JSON_PROPERTY_PREV_OFFSET = "prev_offset"; + private Long prevOffset; + + public static final String JSON_PROPERTY_TOTAL = "total"; + private Long total; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TeamHierarchyMembersOffsetPageType type = TeamHierarchyMembersOffsetPageType.OFFSET_LIMIT; + + public TeamHierarchyMembersOffsetPage() {} + + @JsonCreator + public TeamHierarchyMembersOffsetPage( + @JsonProperty(required = true, value = JSON_PROPERTY_FIRST_OFFSET) Long firstOffset, + @JsonProperty(required = true, value = JSON_PROPERTY_LAST_OFFSET) Long lastOffset, + @JsonProperty(required = true, value = JSON_PROPERTY_LIMIT) Long limit, + @JsonProperty(required = true, value = JSON_PROPERTY_NEXT_OFFSET) Long nextOffset, + @JsonProperty(required = true, value = JSON_PROPERTY_OFFSET) Long offset, + @JsonProperty(required = true, value = JSON_PROPERTY_PREV_OFFSET) Long prevOffset, + @JsonProperty(required = true, value = JSON_PROPERTY_TOTAL) Long total, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + TeamHierarchyMembersOffsetPageType type) { + this.firstOffset = firstOffset; + this.lastOffset = lastOffset; + if (lastOffset != null) {} + this.limit = limit; + this.nextOffset = nextOffset; + if (nextOffset != null) {} + this.offset = offset; + this.prevOffset = prevOffset; + if (prevOffset != null) {} + this.total = total; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TeamHierarchyMembersOffsetPage firstOffset(Long firstOffset) { + this.firstOffset = firstOffset; + return this; + } + + /** + * First offset. + * + * @return firstOffset + */ + @JsonProperty(JSON_PROPERTY_FIRST_OFFSET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getFirstOffset() { + return firstOffset; + } + + public void setFirstOffset(Long firstOffset) { + this.firstOffset = firstOffset; + } + + public TeamHierarchyMembersOffsetPage lastOffset(Long lastOffset) { + this.lastOffset = lastOffset; + if (lastOffset != null) {} + return this; + } + + /** + * Last offset. Null when unavailable. + * + * @return lastOffset + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST_OFFSET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getLastOffset() { + return lastOffset; + } + + public void setLastOffset(Long lastOffset) { + this.lastOffset = lastOffset; + } + + public TeamHierarchyMembersOffsetPage limit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Maximum number of members per page. + * + * @return limit + */ + @JsonProperty(JSON_PROPERTY_LIMIT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getLimit() { + return limit; + } + + public void setLimit(Long limit) { + this.limit = limit; + } + + public TeamHierarchyMembersOffsetPage nextOffset(Long nextOffset) { + this.nextOffset = nextOffset; + if (nextOffset != null) {} + return this; + } + + /** + * Next offset. Null when unavailable. + * + * @return nextOffset + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NEXT_OFFSET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getNextOffset() { + return nextOffset; + } + + public void setNextOffset(Long nextOffset) { + this.nextOffset = nextOffset; + } + + public TeamHierarchyMembersOffsetPage offset(Long offset) { + this.offset = offset; + return this; + } + + /** + * Current offset. + * + * @return offset + */ + @JsonProperty(JSON_PROPERTY_OFFSET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getOffset() { + return offset; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public TeamHierarchyMembersOffsetPage prevOffset(Long prevOffset) { + this.prevOffset = prevOffset; + if (prevOffset != null) {} + return this; + } + + /** + * Previous offset. Null when unavailable. + * + * @return prevOffset + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PREV_OFFSET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getPrevOffset() { + return prevOffset; + } + + public void setPrevOffset(Long prevOffset) { + this.prevOffset = prevOffset; + } + + public TeamHierarchyMembersOffsetPage total(Long total) { + this.total = total; + return this; + } + + /** + * Total number of members matching the filters. + * + * @return total + */ + @JsonProperty(JSON_PROPERTY_TOTAL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + + public TeamHierarchyMembersOffsetPage type(TeamHierarchyMembersOffsetPageType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Pagination mode. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamHierarchyMembersOffsetPageType getType() { + return type; + } + + public void setType(TeamHierarchyMembersOffsetPageType 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 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 TeamHierarchyMembersOffsetPage + */ + @JsonAnySetter + public TeamHierarchyMembersOffsetPage putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMembersOffsetPage object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMembersOffsetPage teamHierarchyMembersOffsetPage = + (TeamHierarchyMembersOffsetPage) o; + return Objects.equals(this.firstOffset, teamHierarchyMembersOffsetPage.firstOffset) + && Objects.equals(this.lastOffset, teamHierarchyMembersOffsetPage.lastOffset) + && Objects.equals(this.limit, teamHierarchyMembersOffsetPage.limit) + && Objects.equals(this.nextOffset, teamHierarchyMembersOffsetPage.nextOffset) + && Objects.equals(this.offset, teamHierarchyMembersOffsetPage.offset) + && Objects.equals(this.prevOffset, teamHierarchyMembersOffsetPage.prevOffset) + && Objects.equals(this.total, teamHierarchyMembersOffsetPage.total) + && Objects.equals(this.type, teamHierarchyMembersOffsetPage.type) + && Objects.equals( + this.additionalProperties, teamHierarchyMembersOffsetPage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + firstOffset, + lastOffset, + limit, + nextOffset, + offset, + prevOffset, + total, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMembersOffsetPage {\n"); + sb.append(" firstOffset: ").append(toIndentedString(firstOffset)).append("\n"); + sb.append(" lastOffset: ").append(toIndentedString(lastOffset)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" nextOffset: ").append(toIndentedString(nextOffset)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" prevOffset: ").append(toIndentedString(prevOffset)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).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/TeamHierarchyMembersOffsetPageType.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersOffsetPageType.java new file mode 100644 index 00000000000..64809d469e0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersOffsetPageType.java @@ -0,0 +1,59 @@ +/* + * 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; + +/** Pagination mode. */ +@JsonSerialize( + using = TeamHierarchyMembersOffsetPageType.TeamHierarchyMembersOffsetPageTypeSerializer.class) +public class TeamHierarchyMembersOffsetPageType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("offset_limit")); + + public static final TeamHierarchyMembersOffsetPageType OFFSET_LIMIT = + new TeamHierarchyMembersOffsetPageType("offset_limit"); + + TeamHierarchyMembersOffsetPageType(String value) { + super(value, allowedValues); + } + + public static class TeamHierarchyMembersOffsetPageTypeSerializer + extends StdSerializer { + public TeamHierarchyMembersOffsetPageTypeSerializer( + Class t) { + super(t); + } + + public TeamHierarchyMembersOffsetPageTypeSerializer() { + this(null); + } + + @Override + public void serialize( + TeamHierarchyMembersOffsetPageType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TeamHierarchyMembersOffsetPageType fromValue(String value) { + return new TeamHierarchyMembersOffsetPageType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersPage.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersPage.java new file mode 100644 index 00000000000..1595ff91fd3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersPage.java @@ -0,0 +1,290 @@ +/* + * 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 = TeamHierarchyMembersPage.TeamHierarchyMembersPageDeserializer.class) +@JsonSerialize(using = TeamHierarchyMembersPage.TeamHierarchyMembersPageSerializer.class) +public class TeamHierarchyMembersPage extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(TeamHierarchyMembersPage.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class TeamHierarchyMembersPageSerializer + extends StdSerializer { + public TeamHierarchyMembersPageSerializer(Class t) { + super(t); + } + + public TeamHierarchyMembersPageSerializer() { + this(null); + } + + @Override + public void serialize( + TeamHierarchyMembersPage value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class TeamHierarchyMembersPageDeserializer + extends StdDeserializer { + public TeamHierarchyMembersPageDeserializer() { + this(TeamHierarchyMembersPage.class); + } + + public TeamHierarchyMembersPageDeserializer(Class vc) { + super(vc); + } + + @Override + public TeamHierarchyMembersPage 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 TeamHierarchyMembersOffsetPage + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (TeamHierarchyMembersOffsetPage.class.equals(Integer.class) + || TeamHierarchyMembersOffsetPage.class.equals(Long.class) + || TeamHierarchyMembersOffsetPage.class.equals(Float.class) + || TeamHierarchyMembersOffsetPage.class.equals(Double.class) + || TeamHierarchyMembersOffsetPage.class.equals(Boolean.class) + || TeamHierarchyMembersOffsetPage.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((TeamHierarchyMembersOffsetPage.class.equals(Integer.class) + || TeamHierarchyMembersOffsetPage.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((TeamHierarchyMembersOffsetPage.class.equals(Float.class) + || TeamHierarchyMembersOffsetPage.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (TeamHierarchyMembersOffsetPage.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (TeamHierarchyMembersOffsetPage.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(TeamHierarchyMembersOffsetPage.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 (!((TeamHierarchyMembersOffsetPage) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'TeamHierarchyMembersOffsetPage'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'TeamHierarchyMembersOffsetPage'", e); + } + + // deserialize TeamHierarchyMembersNumberPage + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (TeamHierarchyMembersNumberPage.class.equals(Integer.class) + || TeamHierarchyMembersNumberPage.class.equals(Long.class) + || TeamHierarchyMembersNumberPage.class.equals(Float.class) + || TeamHierarchyMembersNumberPage.class.equals(Double.class) + || TeamHierarchyMembersNumberPage.class.equals(Boolean.class) + || TeamHierarchyMembersNumberPage.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((TeamHierarchyMembersNumberPage.class.equals(Integer.class) + || TeamHierarchyMembersNumberPage.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((TeamHierarchyMembersNumberPage.class.equals(Float.class) + || TeamHierarchyMembersNumberPage.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (TeamHierarchyMembersNumberPage.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (TeamHierarchyMembersNumberPage.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(TeamHierarchyMembersNumberPage.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 (!((TeamHierarchyMembersNumberPage) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'TeamHierarchyMembersNumberPage'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'TeamHierarchyMembersNumberPage'", e); + } + + TeamHierarchyMembersPage ret = new TeamHierarchyMembersPage(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public TeamHierarchyMembersPage getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "TeamHierarchyMembersPage cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public TeamHierarchyMembersPage() { + super("oneOf", Boolean.FALSE); + } + + public TeamHierarchyMembersPage(TeamHierarchyMembersOffsetPage o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public TeamHierarchyMembersPage(TeamHierarchyMembersNumberPage o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "TeamHierarchyMembersOffsetPage", new GenericType() {}); + schemas.put( + "TeamHierarchyMembersNumberPage", new GenericType() {}); + JSON.registerDescendants(TeamHierarchyMembersPage.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return TeamHierarchyMembersPage.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: TeamHierarchyMembersOffsetPage, TeamHierarchyMembersNumberPage + * + *

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( + TeamHierarchyMembersOffsetPage.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf( + TeamHierarchyMembersNumberPage.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be TeamHierarchyMembersOffsetPage," + + " TeamHierarchyMembersNumberPage"); + } + + /** + * Get the actual instance, which can be the following: TeamHierarchyMembersOffsetPage, + * TeamHierarchyMembersNumberPage + * + * @return The actual instance (TeamHierarchyMembersOffsetPage, TeamHierarchyMembersNumberPage) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `TeamHierarchyMembersOffsetPage`. If the actual instance is not + * `TeamHierarchyMembersOffsetPage`, the ClassCastException will be thrown. + * + * @return The actual instance of `TeamHierarchyMembersOffsetPage` + * @throws ClassCastException if the instance is not `TeamHierarchyMembersOffsetPage` + */ + public TeamHierarchyMembersOffsetPage getTeamHierarchyMembersOffsetPage() + throws ClassCastException { + return (TeamHierarchyMembersOffsetPage) super.getActualInstance(); + } + + /** + * Get the actual instance of `TeamHierarchyMembersNumberPage`. If the actual instance is not + * `TeamHierarchyMembersNumberPage`, the ClassCastException will be thrown. + * + * @return The actual instance of `TeamHierarchyMembersNumberPage` + * @throws ClassCastException if the instance is not `TeamHierarchyMembersNumberPage` + */ + public TeamHierarchyMembersNumberPage getTeamHierarchyMembersNumberPage() + throws ClassCastException { + return (TeamHierarchyMembersNumberPage) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersResponse.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersResponse.java new file mode 100644 index 00000000000..5f9c6707c08 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersResponse.java @@ -0,0 +1,279 @@ +/* + * 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.JsonCreator; +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; + +/** Direct and inherited members of the requested team. */ +@JsonPropertyOrder({ + TeamHierarchyMembersResponse.JSON_PROPERTY_DATA, + TeamHierarchyMembersResponse.JSON_PROPERTY_INCLUDED, + TeamHierarchyMembersResponse.JSON_PROPERTY_LINKS, + TeamHierarchyMembersResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMembersResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_INCLUDED = "included"; + private List included = null; + + public static final String JSON_PROPERTY_LINKS = "links"; + private TeamHierarchyMembersResponseLinks links; + + public static final String JSON_PROPERTY_META = "meta"; + private TeamHierarchyMembersResponseMeta meta; + + public TeamHierarchyMembersResponse() {} + + @JsonCreator + public TeamHierarchyMembersResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data, + @JsonProperty(required = true, value = JSON_PROPERTY_LINKS) + TeamHierarchyMembersResponseLinks links, + @JsonProperty(required = true, value = JSON_PROPERTY_META) + TeamHierarchyMembersResponseMeta meta) { + this.data = data; + for (TeamHierarchyMember item : data) { + this.unparsed |= item.unparsed; + } + this.links = links; + this.unparsed |= links.unparsed; + this.meta = meta; + this.unparsed |= meta.unparsed; + } + + public TeamHierarchyMembersResponse data(List data) { + this.data = data; + for (TeamHierarchyMember item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TeamHierarchyMembersResponse addDataItem(TeamHierarchyMember dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * One relationship per user. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + if (data != null) { + for (TeamHierarchyMember item : data) { + this.unparsed |= item.unparsed; + } + } + } + + public TeamHierarchyMembersResponse included(List included) { + this.included = included; + if (included != null) { + for (TeamHierarchyMemberIncluded item : included) { + this.unparsed |= item.unparsed; + } + } + return this; + } + + public TeamHierarchyMembersResponse addIncludedItem(TeamHierarchyMemberIncluded includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + this.unparsed |= includedItem.unparsed; + return this; + } + + /** + * Requested users and the team. May be absent when the result is empty, even if requested. + * + * @return included + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCLUDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIncluded() { + return included; + } + + public void setIncluded(List included) { + this.included = included; + if (included != null) { + for (TeamHierarchyMemberIncluded item : included) { + this.unparsed |= item.unparsed; + } + } + } + + public TeamHierarchyMembersResponse links(TeamHierarchyMembersResponseLinks links) { + this.links = links; + this.unparsed |= links.unparsed; + return this; + } + + /** + * Page navigation links. Unavailable links are omitted. + * + * @return links + */ + @JsonProperty(JSON_PROPERTY_LINKS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamHierarchyMembersResponseLinks getLinks() { + return links; + } + + public void setLinks(TeamHierarchyMembersResponseLinks links) { + this.links = links; + if (links != null) { + this.unparsed |= links.unparsed; + } + } + + public TeamHierarchyMembersResponse meta(TeamHierarchyMembersResponseMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Pagination metadata for the filtered members. + * + * @return meta + */ + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamHierarchyMembersResponseMeta getMeta() { + return meta; + } + + public void setMeta(TeamHierarchyMembersResponseMeta meta) { + this.meta = meta; + if (meta != null) { + this.unparsed |= meta.unparsed; + } + } + + /** + * 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 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 TeamHierarchyMembersResponse + */ + @JsonAnySetter + public TeamHierarchyMembersResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMembersResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMembersResponse teamHierarchyMembersResponse = (TeamHierarchyMembersResponse) o; + return Objects.equals(this.data, teamHierarchyMembersResponse.data) + && Objects.equals(this.included, teamHierarchyMembersResponse.included) + && Objects.equals(this.links, teamHierarchyMembersResponse.links) + && Objects.equals(this.meta, teamHierarchyMembersResponse.meta) + && Objects.equals( + this.additionalProperties, teamHierarchyMembersResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, links, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMembersResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).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/TeamHierarchyMembersResponseLinks.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersResponseLinks.java new file mode 100644 index 00000000000..78ef5ea60b9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersResponseLinks.java @@ -0,0 +1,247 @@ +/* + * 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; + +/** Page navigation links. Unavailable links are omitted. */ +@JsonPropertyOrder({ + TeamHierarchyMembersResponseLinks.JSON_PROPERTY_FIRST, + TeamHierarchyMembersResponseLinks.JSON_PROPERTY_LAST, + TeamHierarchyMembersResponseLinks.JSON_PROPERTY_NEXT, + TeamHierarchyMembersResponseLinks.JSON_PROPERTY_PREV, + TeamHierarchyMembersResponseLinks.JSON_PROPERTY_SELF +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMembersResponseLinks { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FIRST = "first"; + private String first; + + public static final String JSON_PROPERTY_LAST = "last"; + private String last; + + public static final String JSON_PROPERTY_NEXT = "next"; + private String next; + + public static final String JSON_PROPERTY_PREV = "prev"; + private String prev; + + public static final String JSON_PROPERTY_SELF = "self"; + private String self; + + public TeamHierarchyMembersResponseLinks first(String first) { + this.first = first; + return this; + } + + /** + * First page URL. + * + * @return first + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FIRST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFirst() { + return first; + } + + public void setFirst(String first) { + this.first = first; + } + + public TeamHierarchyMembersResponseLinks last(String last) { + this.last = last; + return this; + } + + /** + * Last page URL. + * + * @return last + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLast() { + return last; + } + + public void setLast(String last) { + this.last = last; + } + + public TeamHierarchyMembersResponseLinks next(String next) { + this.next = next; + return this; + } + + /** + * Next page URL. + * + * @return next + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getNext() { + return next; + } + + public void setNext(String next) { + this.next = next; + } + + public TeamHierarchyMembersResponseLinks prev(String prev) { + this.prev = prev; + return this; + } + + /** + * Previous page URL. + * + * @return prev + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PREV) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPrev() { + return prev; + } + + public void setPrev(String prev) { + this.prev = prev; + } + + public TeamHierarchyMembersResponseLinks self(String self) { + this.self = self; + return this; + } + + /** + * Current page URL. + * + * @return self + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SELF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSelf() { + return self; + } + + public void setSelf(String self) { + this.self = self; + } + + /** + * 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 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 TeamHierarchyMembersResponseLinks + */ + @JsonAnySetter + public TeamHierarchyMembersResponseLinks putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMembersResponseLinks object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMembersResponseLinks teamHierarchyMembersResponseLinks = + (TeamHierarchyMembersResponseLinks) o; + return Objects.equals(this.first, teamHierarchyMembersResponseLinks.first) + && Objects.equals(this.last, teamHierarchyMembersResponseLinks.last) + && Objects.equals(this.next, teamHierarchyMembersResponseLinks.next) + && Objects.equals(this.prev, teamHierarchyMembersResponseLinks.prev) + && Objects.equals(this.self, teamHierarchyMembersResponseLinks.self) + && Objects.equals( + this.additionalProperties, teamHierarchyMembersResponseLinks.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(first, last, next, prev, self, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMembersResponseLinks {\n"); + sb.append(" first: ").append(toIndentedString(first)).append("\n"); + sb.append(" last: ").append(toIndentedString(last)).append("\n"); + sb.append(" next: ").append(toIndentedString(next)).append("\n"); + sb.append(" prev: ").append(toIndentedString(prev)).append("\n"); + sb.append(" self: ").append(toIndentedString(self)).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/TeamHierarchyMembersResponseMeta.java b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersResponseMeta.java new file mode 100644 index 00000000000..ecbede560b8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TeamHierarchyMembersResponseMeta.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.JsonCreator; +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; + +/** Pagination metadata for the filtered members. */ +@JsonPropertyOrder({TeamHierarchyMembersResponseMeta.JSON_PROPERTY_PAGE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TeamHierarchyMembersResponseMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PAGE = "page"; + private TeamHierarchyMembersPage page; + + public TeamHierarchyMembersResponseMeta() {} + + @JsonCreator + public TeamHierarchyMembersResponseMeta( + @JsonProperty(required = true, value = JSON_PROPERTY_PAGE) TeamHierarchyMembersPage page) { + this.page = page; + this.unparsed |= page.unparsed; + } + + public TeamHierarchyMembersResponseMeta page(TeamHierarchyMembersPage page) { + this.page = page; + this.unparsed |= page.unparsed; + return this; + } + + /** + * Pagination metadata for the selected pagination mode. + * + * @return page + */ + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TeamHierarchyMembersPage getPage() { + return page; + } + + public void setPage(TeamHierarchyMembersPage page) { + this.page = page; + if (page != null) { + this.unparsed |= page.unparsed; + } + } + + /** + * 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 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 TeamHierarchyMembersResponseMeta + */ + @JsonAnySetter + public TeamHierarchyMembersResponseMeta putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 TeamHierarchyMembersResponseMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamHierarchyMembersResponseMeta teamHierarchyMembersResponseMeta = + (TeamHierarchyMembersResponseMeta) o; + return Objects.equals(this.page, teamHierarchyMembersResponseMeta.page) + && Objects.equals( + this.additionalProperties, teamHierarchyMembersResponseMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(page, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamHierarchyMembersResponseMeta {\n"); + sb.append(" page: ").append(toIndentedString(page)).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/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index b307445fc2c..1a968610490 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/given.json @@ -1961,6 +1961,38 @@ "tag": "Teams", "operationId": "CreateTeamLink" }, + { + "parameters": [ + { + "name": "team_id", + "source": "dd_team_2.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"role\": \"admin\"\n },\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"{{team_hierarchy_user.data.id}}\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"team_memberships\"\n }\n}" + } + ], + "step": "there is a valid \"team_hierarchy_child_membership\" in the system", + "key": "team_hierarchy_child_membership", + "tag": "Teams", + "operationId": "CreateTeamMembership" + }, + { + "parameters": [ + { + "name": "team_id", + "source": "dd_team_2.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"role\": \"admin\"\n },\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"{{user.data.id}}\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"team_memberships\"\n }\n}" + } + ], + "step": "there is a valid \"team_hierarchy_duplicate_membership\" in the system", + "key": "team_hierarchy_duplicate_membership", + "tag": "Teams", + "operationId": "CreateTeamMembership" + }, { "parameters": [ { @@ -2006,6 +2038,18 @@ "tag": "Users", "operationId": "SendInvitations" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"users\",\n \"attributes\": {\n \"email\": \"hierarchy-{{ unique }}@datadoghq.com\",\n \"name\": \"Hierarchy member\"\n }\n }\n}" + } + ], + "step": "there is a valid \"team_hierarchy_user\" in the system", + "key": "team_hierarchy_user", + "tag": "Users", + "operationId": "CreateUser" + }, { "parameters": [ { diff --git a/src/test/resources/com/datadog/api/client/v2/api/teams.feature b/src/test/resources/com/datadog/api/client/v2/api/teams.feature index 4133b1f46eb..1a14900099e 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/teams.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/teams.feature @@ -378,6 +378,271 @@ Feature: Teams When the request with pagination is sent Then the response status is 200 OK + @skip @team:ddoghq/aaa-omg + Scenario: Get team hierarchy members deduplicates direct and inherited membership + Given operation "GetTeamHierarchyMembers" enabled + And new "GetTeamHierarchyMembers" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And there is a valid "team_hierarchy_user" in the system + And there is a valid "team_hierarchy_child_membership" in the system + And there is a valid "user" in the system + And there is a valid "team_membership" in the system + And there is a valid "team_hierarchy_duplicate_membership" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "filter[keyword]" parameter with value "{{ unique }}" + And request contains "sort" parameter with value "-is_direct,handle" + And request contains "include" parameter with value "team" + When the request is sent + Then the response status is 200 OK + And the response "data" has length 2 + And the response "meta.page.total" is equal to 2 + And the response "data[0].relationships.user.data.id" is equal to "{{ user.data.id }}" + And the response "data[0].attributes.is_direct" is equal to true + And the response "data[0].attributes.direct_role" is equal to "admin" + And the response "data[1].relationships.user.data.id" is equal to "{{ team_hierarchy_user.data.id }}" + And the response "data[1].attributes.is_direct" is equal to false + And the response "included" has length 1 + And the response "included[0].id" is equal to "{{ dd_team.data.id }}" + + @skip @team:ddoghq/aaa-omg + Scenario: Get team hierarchy members filters direct members + Given operation "GetTeamHierarchyMembers" enabled + And new "GetTeamHierarchyMembers" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And there is a valid "team_hierarchy_user" in the system + And there is a valid "team_hierarchy_child_membership" in the system + And there is a valid "user" in the system + And there is a valid "team_membership" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "filter[keyword]" parameter with value "{{ unique }}" + And request contains "filter[is_direct_only]" parameter with value true + And request contains "filter[include_service_accounts]" parameter with value false + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "data[0].relationships.user.data.id" is equal to "{{ user.data.id }}" + And the response "data[0].attributes.is_direct" is equal to true + + @skip @team:ddoghq/aaa-omg + Scenario: Get team hierarchy members filters names case insensitively + Given operation "GetTeamHierarchyMembers" enabled + And new "GetTeamHierarchyMembers" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And there is a valid "team_hierarchy_user" in the system + And there is a valid "team_hierarchy_child_membership" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "filter[keyword]" parameter with value "hIeRaRcHy MeMbEr" + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "data[0].relationships.user.data.id" is equal to "{{ team_hierarchy_user.data.id }}" + + @skip @team:ddoghq/aaa-omg + Scenario: Get team hierarchy members includes inherited users with null root membership attributes + Given operation "GetTeamHierarchyMembers" enabled + And new "GetTeamHierarchyMembers" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And there is a valid "team_hierarchy_user" in the system + And there is a valid "team_hierarchy_child_membership" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "filter[keyword]" parameter with value "{{ unique }}" + And request contains "include" parameter with value "user,team" + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "data[0].attributes.is_direct" is equal to false + And the response "data[0].attributes.direct_role" is equal to null + And the response "data[0].attributes.provisioned_by" is equal to null + And the response "data[0].attributes.provisioned_by_id" is equal to null + And the response "data[0].relationships.user.data.id" is equal to "{{ team_hierarchy_user.data.id }}" + And the response "data[0].relationships.team.data.id" is equal to "{{ dd_team.data.id }}" + And the response "included" has length 2 + And the response "included" has item with field "id" with value "{{ dd_team.data.id }}" + + @skip @team:ddoghq/aaa-omg + Scenario: Get team hierarchy members normalizes number pagination + Given operation "GetTeamHierarchyMembers" enabled + And new "GetTeamHierarchyMembers" request + And there is a valid "dd_team" in the system + And there is a valid "user" in the system + And there is a valid "team_membership" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "filter[keyword]" parameter with value "{{ unique }}" + And request contains "page[number]" parameter with value -1 + And request contains "page[size]" parameter with value 101 + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "meta.page.number" is equal to 0 + And the response "meta.page.size" is equal to 100 + + @skip @team:ddoghq/aaa-omg + Scenario: Get team hierarchy members paginates by number and size + Given operation "GetTeamHierarchyMembers" enabled + And new "GetTeamHierarchyMembers" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And there is a valid "team_hierarchy_user" in the system + And there is a valid "team_hierarchy_child_membership" in the system + And there is a valid "user" in the system + And there is a valid "team_membership" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "filter[keyword]" parameter with value "{{ unique }}" + And request contains "sort" parameter with value "-is_direct" + And request contains "page[number]" parameter with value 1 + And request contains "page[size]" parameter with value 1 + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "data[0].attributes.is_direct" is equal to false + And the response "meta.page.type" is equal to "number_size" + And the response "meta.page.number" is equal to 1 + And the response "meta.page.size" is equal to 1 + And the response "meta.page.total" is equal to 2 + + @skip @team:ddoghq/aaa-omg + Scenario: Get team hierarchy members rejects unsupported includes + Given operation "GetTeamHierarchyMembers" enabled + And new "GetTeamHierarchyMembers" request + And there is a valid "dd_team" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "include" parameter with value "descendants" + When the request is sent + Then the response status is 400 Bad Request + And the response "errors[0].status" is equal to "400" + + @skip @team:ddoghq/aaa-omg + Scenario: Get team hierarchy members returns "Bad Request" response + Given operation "GetTeamHierarchyMembers" enabled + And new "GetTeamHierarchyMembers" request + And there is a valid "dd_team" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "sort" parameter with value "invalid" + When the request is sent + Then the response status is 400 Bad Request + And the response "errors[0].status" is equal to "400" + + @skip @team:ddoghq/aaa-omg + Scenario: Get team hierarchy members returns "Not Found" response + Given operation "GetTeamHierarchyMembers" enabled + And new "GetTeamHierarchyMembers" request + And request contains "team_id" parameter with value "00000000-0000-4000-8000-000000000000" + When the request is sent + Then the response status is 404 Not Found + And the response "errors[0].status" is equal to "404" + + @skip @team:ddoghq/aaa-omg + Scenario: Get team hierarchy members returns "OK" response + Given operation "GetTeamHierarchyMembers" enabled + And new "GetTeamHierarchyMembers" request + And there is a valid "dd_team" in the system + And there is a valid "user" in the system + And there is a valid "team_membership" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "filter[keyword]" parameter with value "{{ user.data.attributes.email }}" + And request contains "include" parameter with value "user,team" + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "data[0].id" is equal to "UserTeamRelationship:{{ dd_team.data.id }}:{{ user.data.id }}" + And the response "data[0].type" is equal to "user_team_relationship" + And the response "data[0].attributes.is_direct" is equal to true + And the response "data[0].attributes.direct_role" is equal to "admin" + And the response "data[0].relationships.user.data.type" is equal to "users" + And the response "data[0].relationships.team.data.type" is equal to "teams" + And the response "data[0].relationships.team.data.id" is equal to "{{ dd_team.data.id }}" + And the response "included" has length 2 + And the response "included" has item with field "id" with value "{{ user.data.id }}" + And the response "included" has item with field "id" with value "{{ dd_team.data.id }}" + And the response "meta.page.type" is equal to "offset_limit" + And the response "meta.page.limit" is equal to 100 + And the response "meta.page.total" is equal to 1 + + @replay-only @skip @skip-validation @team:ddoghq/aaa-omg @with-pagination + Scenario: Get team hierarchy members returns "OK" response with pagination + Given operation "GetTeamHierarchyMembers" enabled + And new "GetTeamHierarchyMembers" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And there is a valid "team_hierarchy_user" in the system + And there is a valid "team_hierarchy_child_membership" in the system + And there is a valid "user" in the system + And there is a valid "team_membership" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "filter[keyword]" parameter with value "{{ unique }}" + And request contains "page[size]" parameter with value 1 + When the request with pagination is sent + Then the response status is 200 OK + And the response has 2 items + + @skip @team:ddoghq/aaa-omg + Scenario: Get team hierarchy members returns empty results + Given operation "GetTeamHierarchyMembers" enabled + And new "GetTeamHierarchyMembers" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And there is a valid "team_hierarchy_user" in the system + And there is a valid "team_hierarchy_child_membership" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "filter[keyword]" parameter with value "no-matching-member-{{ unique }}" + And request contains "include" parameter with value "user,team" + When the request is sent + Then the response status is 200 OK + And the response "data" has length 0 + And the response "meta.page.total" is equal to 0 + + @skip @team:ddoghq/aaa-omg + Scenario: Get team hierarchy members selects number pagination from page size alone + Given operation "GetTeamHierarchyMembers" enabled + And new "GetTeamHierarchyMembers" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And there is a valid "team_hierarchy_user" in the system + And there is a valid "team_hierarchy_child_membership" in the system + And there is a valid "user" in the system + And there is a valid "team_membership" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "filter[keyword]" parameter with value "{{ unique }}" + And request contains "page[size]" parameter with value 1 + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "meta.page.type" is equal to "number_size" + And the response "meta.page.number" is equal to 0 + And the response "meta.page.size" is equal to 1 + + @skip @team:ddoghq/aaa-omg + Scenario: Get team hierarchy members sorts inherited members before direct members + Given operation "GetTeamHierarchyMembers" enabled + And new "GetTeamHierarchyMembers" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And there is a valid "team_hierarchy_user" in the system + And there is a valid "team_hierarchy_child_membership" in the system + And there is a valid "user" in the system + And there is a valid "team_membership" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "filter[keyword]" parameter with value "{{ unique }}" + And request contains "sort" parameter with value "is_direct,-name" + When the request is sent + Then the response status is 200 OK + And the response "data" has length 2 + And the response "data[0].relationships.user.data.id" is equal to "{{ team_hierarchy_user.data.id }}" + And the response "data[1].relationships.user.data.id" is equal to "{{ user.data.id }}" + @team:ddoghq/aaa-omg Scenario: Get team memberships returns "API error response." response Given new "GetTeamMemberships" request diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 68ab96be667..9092e01f76e 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -10854,6 +10854,12 @@ "type": "idempotent" } }, + "GetTeamHierarchyMembers": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, "GetTeamMemberships": { "tag": "Teams", "undo": {