diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6606535523d..093a28a0b5b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -101462,7 +101462,13 @@ paths: application/json: schema: $ref: '#/components/schemas/UserTeamResponse' - description: Represents a user's association to a team + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. '403': $ref: '#/components/responses/ForbiddenResponse' '404': diff --git a/examples/v2/teams/UpdateTeamMembership.java b/examples/v2/teams/UpdateTeamMembership.java index 18ca37e802a..a6152b24ab2 100644 --- a/examples/v2/teams/UpdateTeamMembership.java +++ b/examples/v2/teams/UpdateTeamMembership.java @@ -1,5 +1,4 @@ -// Update a user's membership attributes on a team returns "Represents a user's association to a -// team" response +// Update a user's membership attributes on a team returns "OK" response import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; @@ -16,6 +15,12 @@ public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); 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_ID = System.getenv("USER_DATA_ID"); + UserTeamUpdateRequest body = new UserTeamUpdateRequest() .data( @@ -24,7 +29,8 @@ public static void main(String[] args) { .type(UserTeamType.TEAM_MEMBERSHIPS)); try { - UserTeamResponse result = apiInstance.updateTeamMembership("team_id", "user_id", body); + UserTeamResponse result = + apiInstance.updateTeamMembership(DD_TEAM_DATA_ID, USER_DATA_ID, body); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling TeamsApi#updateTeamMembership"); 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 0cd8e0b3f05..59ea3516b4b 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 @@ -5513,7 +5513,8 @@ public CompletableFuture updateTeamMembershipAsync( * * * - * + * + * * * * diff --git a/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_returns_API_error_response_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_returns_API_error_response_response.freeze new file mode 100644 index 00000000000..e0d3f487706 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_returns_API_error_response_response.freeze @@ -0,0 +1 @@ +2026-02-12T14:57:57.281Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_returns_API_error_response_response.json b/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_returns_API_error_response_response.json new file mode 100644 index 00000000000..c83a27286bf --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_returns_API_error_response_response.json @@ -0,0 +1,83 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-d1ea4282abe3f68d\",\"name\":\"test-name-d1ea4282abe3f68d\"},\"type\":\"team\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"587b5f1a-b8ef-42b7-a99a-746cb80422a4\",\"type\":\"team\",\"attributes\":{\"avatar\":null,\"banner\":6,\"created_at\":\"2026-02-12T14:57:57.783497+00:00\",\"description\":null,\"handle\":\"test-handle-d1ea4282abe3f68d\",\"hidden_modules\":null,\"is_managed\":false,\"link_count\":0,\"modified_at\":\"2026-02-12T14:57:57.783497+00:00\",\"name\":\"test-name-d1ea4282abe3f68d\",\"summary\":null,\"user_count\":0,\"visible_modules\":null},\"relationships\":{\"team_links\":{\"data\":[],\"links\":{\"related\":\"/api/v2/team/587b5f1a-b8ef-42b7-a99a-746cb80422a4/links\"}},\"user_team_permissions\":{\"data\":null,\"links\":{\"related\":\"/api/v2/team/587b5f1a-b8ef-42b7-a99a-746cb80422a4/permission-settings\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "624bd97f-34c0-11c8-9677-ce29642f5d12" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"role\":\"admin\"},\"type\":\"team_memberships\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/team/587b5f1a-b8ef-42b7-a99a-746cb80422a4/memberships/00000000-0000-dead-beef-000000000000", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"User for ID 00000000-0000-dead-beef-000000000000 not found\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "98bc384f-2b99-7a69-d335-cf3ab09cb6bd" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/587b5f1a-b8ef-42b7-a99a-746cb80422a4", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "3d52127d-8b5f-59f0-6ebf-af2b9d69a20f" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_returns_OK_response.freeze new file mode 100644 index 00000000000..cc46640cc52 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-02-12T14:59:46.756Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_returns_OK_response.json new file mode 100644 index 00000000000..1b08f4065a6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_returns_OK_response.json @@ -0,0 +1,185 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-ae403c8f160ec46f\",\"name\":\"test-name-ae403c8f160ec46f\"},\"type\":\"team\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"38c0d1d3-69c0-4452-95a0-0115b22f2607\",\"type\":\"team\",\"attributes\":{\"avatar\":null,\"banner\":13,\"created_at\":\"2026-02-12T14:59:47.252294+00:00\",\"description\":null,\"handle\":\"test-handle-ae403c8f160ec46f\",\"hidden_modules\":null,\"is_managed\":false,\"link_count\":0,\"modified_at\":\"2026-02-12T14:59:47.252294+00:00\",\"name\":\"test-name-ae403c8f160ec46f\",\"summary\":null,\"user_count\":0,\"visible_modules\":null},\"relationships\":{\"team_links\":{\"data\":[],\"links\":{\"related\":\"/api/v2/team/38c0d1d3-69c0-4452-95a0-0115b22f2607/links\"}},\"user_team_permissions\":{\"data\":null,\"links\":{\"related\":\"/api/v2/team/38c0d1d3-69c0-4452-95a0-0115b22f2607/permission-settings\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "784ce82e-6536-749b-bc9b-78e31cabeafc" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":\"Test-Update_a_user_s_membership_attributes_on_a_team_returns_OK_response-1770908386@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/users", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"users\",\"id\":\"3330c2ed-ac5d-458e-875b-ffc85c436edc\",\"attributes\":{\"name\":null,\"handle\":\"test-update_a_user_s_membership_attributes_on_a_team_returns_ok_response-1770908386@datadoghq.com\",\"created_at\":\"2026-02-12T14:59:47.812309+00:00\",\"modified_at\":\"2026-02-12T14:59:47.812309+00:00\",\"email\":\"test-update_a_user_s_membership_attributes_on_a_team_returns_ok_response-1770908386@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/7906350a0aeb9c3285de81609654b5df?s=48&d=retro\",\"title\":\"user title\",\"verified\":false,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Pending\",\"last_login_time\":null},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "7f26bead-3f49-2154-69a5-1b1c885a3850" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"role\":\"admin\"},\"relationships\":{\"user\":{\"data\":{\"id\":\"3330c2ed-ac5d-458e-875b-ffc85c436edc\",\"type\":\"users\"}}},\"type\":\"team_memberships\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team/38c0d1d3-69c0-4452-95a0-0115b22f2607/memberships", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"TeamMembership-38c0d1d3-69c0-4452-95a0-0115b22f2607-65393600\",\"type\":\"team_memberships\",\"attributes\":{\"provisioned_by\":null,\"provisioned_by_id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"role\":\"admin\"},\"relationships\":{\"user\":{\"data\":{\"id\":\"3330c2ed-ac5d-458e-875b-ffc85c436edc\",\"type\":\"users\"}}}},\"included\":[{\"id\":\"3330c2ed-ac5d-458e-875b-ffc85c436edc\",\"type\":\"users\",\"attributes\":{\"disabled\":false,\"email\":\"test-update_a_user_s_membership_attributes_on_a_team_returns_ok_response-1770908386@datadoghq.com\",\"handle\":\"test-update_a_user_s_membership_attributes_on_a_team_returns_ok_response-1770908386@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/7906350a0aeb9c3285de81609654b5df?d=retro\\u0026s=48\",\"name\":null,\"service_account\":false,\"status\":\"Pending\"}}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "03462c70-4616-7081-49e1-3ecc73c71719" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"role\":\"admin\"},\"type\":\"team_memberships\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/team/38c0d1d3-69c0-4452-95a0-0115b22f2607/memberships/3330c2ed-ac5d-458e-875b-ffc85c436edc", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"team_memberships\",\"id\":\"TeamMembership-38c0d1d3-69c0-4452-95a0-0115b22f2607-65393600\",\"attributes\":{\"role\":\"admin\",\"provisioned_by\":null,\"provisioned_by_id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"},\"relationships\":{\"user\":{\"data\":{\"type\":\"users\",\"id\":\"3330c2ed-ac5d-458e-875b-ffc85c436edc\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"3330c2ed-ac5d-458e-875b-ffc85c436edc\",\"attributes\":{\"name\":null,\"handle\":\"test-update_a_user_s_membership_attributes_on_a_team_returns_ok_response-1770908386@datadoghq.com\",\"email\":\"test-update_a_user_s_membership_attributes_on_a_team_returns_ok_response-1770908386@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/7906350a0aeb9c3285de81609654b5df?s=48&d=retro\",\"disabled\":false,\"service_account\":false}}]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "bd65542c-2131-b4c8-1f47-49a54b50c8c2" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/38c0d1d3-69c0-4452-95a0-0115b22f2607/memberships/3330c2ed-ac5d-458e-875b-ffc85c436edc", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "1a0c4e3f-e198-fe88-e797-2b17a2dfcc5f" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/users/3330c2ed-ac5d-458e-875b-ffc85c436edc", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "36dedfde-22af-c27c-992c-ca705b61ef2c" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/38c0d1d3-69c0-4452-95a0-0115b22f2607", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "bc4d2ef6-62d0-8fd1-5aa8-9e3b06015afe" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_API_error_response_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_API_error_response_response.freeze new file mode 100644 index 00000000000..ed1f12c9d23 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_API_error_response_response.freeze @@ -0,0 +1 @@ +2026-02-12T15:00:05.356Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_API_error_response_response.json b/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_API_error_response_response.json new file mode 100644 index 00000000000..e442ebba7a3 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_API_error_response_response.json @@ -0,0 +1,185 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-ff2b53b6514455c7\",\"name\":\"test-name-ff2b53b6514455c7\"},\"type\":\"team\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"9c2a3be7-8a43-4f37-bc3d-88248875f867\",\"type\":\"team\",\"attributes\":{\"avatar\":null,\"banner\":3,\"created_at\":\"2026-02-12T15:00:05.867555+00:00\",\"description\":null,\"handle\":\"test-handle-ff2b53b6514455c7\",\"hidden_modules\":null,\"is_managed\":false,\"link_count\":0,\"modified_at\":\"2026-02-12T15:00:05.867555+00:00\",\"name\":\"test-name-ff2b53b6514455c7\",\"summary\":null,\"user_count\":0,\"visible_modules\":null},\"relationships\":{\"team_links\":{\"data\":[],\"links\":{\"related\":\"/api/v2/team/9c2a3be7-8a43-4f37-bc3d-88248875f867/links\"}},\"user_team_permissions\":{\"data\":null,\"links\":{\"related\":\"/api/v2/team/9c2a3be7-8a43-4f37-bc3d-88248875f867/permission-settings\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "624fb76e-cc67-c8b2-b0e7-dffd1c43f761" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":\"Test-Update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_API_error_response_respons-1770908405@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/users", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"users\",\"id\":\"eed29272-352e-4bf8-ab48-ad007a1f7179\",\"attributes\":{\"name\":null,\"handle\":\"test-update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_api_error_response_respons-1770908405@datadoghq.com\",\"created_at\":\"2026-02-12T15:00:06.429855+00:00\",\"modified_at\":\"2026-02-12T15:00:06.429855+00:00\",\"email\":\"test-update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_api_error_response_respons-1770908405@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/1a5d1f711a7790783032ea8e4653d473?s=48&d=retro\",\"title\":\"user title\",\"verified\":false,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Pending\",\"last_login_time\":null},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "1dcc6da7-bccc-b21a-616c-31870872f12e" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"role\":\"admin\"},\"relationships\":{\"user\":{\"data\":{\"id\":\"eed29272-352e-4bf8-ab48-ad007a1f7179\",\"type\":\"users\"}}},\"type\":\"team_memberships\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/team/9c2a3be7-8a43-4f37-bc3d-88248875f867/memberships", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"TeamMembership-9c2a3be7-8a43-4f37-bc3d-88248875f867-65393607\",\"type\":\"team_memberships\",\"attributes\":{\"provisioned_by\":null,\"provisioned_by_id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"role\":\"admin\"},\"relationships\":{\"user\":{\"data\":{\"id\":\"eed29272-352e-4bf8-ab48-ad007a1f7179\",\"type\":\"users\"}}}},\"included\":[{\"id\":\"eed29272-352e-4bf8-ab48-ad007a1f7179\",\"type\":\"users\",\"attributes\":{\"disabled\":false,\"email\":\"test-update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_api_error_response_respons-1770908405@datadoghq.com\",\"handle\":\"test-update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_api_error_response_respons-1770908405@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/1a5d1f711a7790783032ea8e4653d473?d=retro\\u0026s=48\",\"name\":null,\"service_account\":false,\"status\":\"Pending\"}}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "d423c681-0174-0098-8861-2d9a8da82d14" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"role\":\"member\"},\"type\":\"team_memberships\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/team/9c2a3be7-8a43-4f37-bc3d-88248875f867/memberships/eed29272-352e-4bf8-ab48-ad007a1f7179", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"{'errors': [{'detail': 'Not a valid choice.', 'source': {'pointer': '/data/attributes/role'}}]}\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "d602fc51-8ab3-2a9e-fbb9-015988f0760f" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/9c2a3be7-8a43-4f37-bc3d-88248875f867/memberships/eed29272-352e-4bf8-ab48-ad007a1f7179", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4fdf4c05-696a-e3cb-5374-0ef3a210b35d" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/users/eed29272-352e-4bf8-ab48-ad007a1f7179", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "403df4d2-5f57-7e4a-2b80-f11163b932e7" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/team/9c2a3be7-8a43-4f37-bc3d-88248875f867", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "27e0cacb-f36a-628f-c339-1b03459fcd05" + } +] \ No newline at end of file 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 3605ca7f8e7..0651545f281 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 @@ -1344,6 +1344,10 @@ }, { "parameters": [ + { + "name": "team_id", + "source": "dd_team.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}" 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 722cc22c405..26bf0130d4e 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 @@ -638,33 +638,41 @@ Feature: Teams And the response "data.attributes.hidden_modules" is equal to ["m3"] And the response "data.attributes.visible_modules" is equal to ["m1", "m2"] - @generated @skip @team:DataDog/aaa-omg + @team:DataDog/aaa-omg Scenario: Update a user's membership attributes on a team returns "API error response." response Given new "UpdateTeamMembership" request - And request contains "team_id" parameter from "REPLACE.ME" - And request contains "user_id" parameter from "REPLACE.ME" + And there is a valid "dd_team" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "user_id" parameter with value "00000000-0000-dead-beef-000000000000" And body with value {"data": {"attributes": {"role": "admin"}, "type": "team_memberships"}} When the request is sent Then the response status is 404 API error response. - @generated @skip @team:DataDog/aaa-omg - Scenario: Update a user's membership attributes on a team returns "Represents a user's association to a team" response + @team:DataDog/aaa-omg + Scenario: Update a user's membership attributes on a team returns "OK" response Given new "UpdateTeamMembership" request - And request contains "team_id" parameter from "REPLACE.ME" - And request contains "user_id" parameter from "REPLACE.ME" + 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 "user_id" parameter from "user.data.id" And body with value {"data": {"attributes": {"role": "admin"}, "type": "team_memberships"}} When the request is sent - Then the response status is 200 Represents a user's association to a team + Then the response status is 200 OK + And the response "data.attributes.role" is equal to "admin" + And the response "data.relationships.user.data.id" is equal to "{{ user.data.id }}" @team:DataDog/aaa-omg - Scenario: Update a user's role on a team returns "API error response." response + Scenario: Update a user's membership attributes on a team with invalid role returns "API error response." response Given new "UpdateTeamMembership" 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 "user_id" parameter with value "REPLACE.ME" - And body with value {"data": {"attributes": {"role": "admin"}, "type": "team_memberships"}} + And request contains "user_id" parameter from "user.data.id" + And body with value {"data": {"attributes": {"role": "member"}, "type": "team_memberships"}} When the request is sent - Then the response status is 404 API error response. + Then the response status is 400 API error response. @team:DataDog/aaa-omg Scenario: Update permission setting for team returns "API error response." response 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 75d0d7f71ed..ef9246c8e64 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 @@ -5565,7 +5565,8 @@ "parameters": [ { "name": "team_id", - "template": "{{team.data.id}}" + "origin": "path", + "source": "team_id" }, { "name": "user_id",
Response details
Status Code Description Response Headers
200 Represents a user's association to a team -
200 OK -
400 API error response. -
403 Forbidden -
404 API error response. -
429 Too many requests -