From 91203b0b4803e8483f030458eaf0763b4517dfd0 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 15 Aug 2025 18:53:36 +0000 Subject: [PATCH] Regenerate client from commit c38287b of spec repo --- .generated-info | 4 +- .generator/schemas/v2/openapi.yaml | 127 +++++++++++++++ .../Sync-teams-returns-OK-response.frozen | 1 + .../teams/Sync-teams-returns-OK-response.yml | 24 +++ examples/v2/teams/SyncTeams.rb | 18 +++ examples/v2/teams/SyncTeams_3215592344.rb | 18 +++ features/scenarios_model_mapping.rb | 3 + features/v2/teams.feature | 106 +++++++------ features/v2/undo.json | 6 + lib/datadog_api_client/configuration.rb | 1 + lib/datadog_api_client/inflector.rb | 6 + lib/datadog_api_client/v2/api/teams_api.rb | 83 ++++++++++ .../v2/models/team_sync_attributes.rb | 144 ++++++++++++++++++ .../v2/models/team_sync_attributes_source.rb | 26 ++++ .../v2/models/team_sync_attributes_type.rb | 26 ++++ .../v2/models/team_sync_bulk_type.rb | 26 ++++ .../v2/models/team_sync_data.rb | 144 ++++++++++++++++++ .../v2/models/team_sync_request.rb | 123 +++++++++++++++ 18 files changed, 839 insertions(+), 47 deletions(-) create mode 100644 cassettes/features/v2/teams/Sync-teams-returns-OK-response.frozen create mode 100644 cassettes/features/v2/teams/Sync-teams-returns-OK-response.yml create mode 100644 examples/v2/teams/SyncTeams.rb create mode 100644 examples/v2/teams/SyncTeams_3215592344.rb create mode 100644 lib/datadog_api_client/v2/models/team_sync_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/team_sync_attributes_source.rb create mode 100644 lib/datadog_api_client/v2/models/team_sync_attributes_type.rb create mode 100644 lib/datadog_api_client/v2/models/team_sync_bulk_type.rb create mode 100644 lib/datadog_api_client/v2/models/team_sync_data.rb create mode 100644 lib/datadog_api_client/v2/models/team_sync_request.rb diff --git a/.generated-info b/.generated-info index 1c7bc67e47b6..cc09a3c17083 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "b434599", - "generated": "2025-08-13 22:15:38.201" + "spec_repo_commit": "c38287b", + "generated": "2025-08-15 18:53:36.766" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d47fcb7159b5..cd3704553e30 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -42824,6 +42824,68 @@ components: urgency: $ref: '#/components/schemas/Urgency' type: object + TeamSyncAttributes: + description: Team sync attributes. + properties: + source: + $ref: '#/components/schemas/TeamSyncAttributesSource' + type: + $ref: '#/components/schemas/TeamSyncAttributesType' + required: + - source + - type + type: object + TeamSyncAttributesSource: + description: The external source platform for team synchronization. Only "github" + is supported. + enum: + - github + example: github + type: string + x-enum-varnames: + - GITHUB + TeamSyncAttributesType: + description: The type of synchronization operation. Only "link" is supported, + which links existing teams by matching names. + enum: + - link + example: link + type: string + x-enum-varnames: + - LINK + TeamSyncBulkType: + description: Team sync bulk type. + enum: + - team_sync_bulk + example: team_sync_bulk + type: string + x-enum-varnames: + - TEAM_SYNC_BULK + TeamSyncData: + description: Team sync data. + properties: + attributes: + $ref: '#/components/schemas/TeamSyncAttributes' + type: + $ref: '#/components/schemas/TeamSyncBulkType' + required: + - attributes + - type + type: object + TeamSyncRequest: + description: Team sync request. + example: + data: + attributes: + source: github + type: link + type: team_sync_bulk + properties: + data: + $ref: '#/components/schemas/TeamSyncData' + required: + - data + type: object TeamTarget: description: Represents a team target for an escalation policy step, including the team's ID and resource type. @@ -65913,6 +65975,71 @@ paths: permissions: - teams_read - teams_manage + /api/v2/team/sync: + post: + description: 'This endpoint attempts to link your existing Datadog teams with + GitHub teams by matching their names. + + It evaluates all current Datadog teams and compares them against teams in + the GitHub organization + + connected to your Datadog account, based on Datadog Team handle and GitHub + Team slug + + (lowercased and kebab-cased). + + + This operation is read-only on the GitHub side, no teams will be modified + or created. + + + [A GitHub organization must be connected to your Datadog account](https://docs.datadoghq.com/integrations/github/), + + and the GitHub App integrated with Datadog must have the `Members Read` permission. + Matching is performed by comparing the Datadog team handle to the GitHub team + slug + + using a normalized exact match; case is ignored and spaces are removed. No + modifications are made + + to teams in GitHub. This will not create new Teams in Datadog.' + operationId: SyncTeams + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TeamSyncRequest' + required: true + responses: + '200': + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Internal Server Error - Unexpected error during linking. + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_manage + summary: Link Teams with GitHub Teams + tags: + - Teams + x-codegen-request-body-name: body + x-permission: + operator: AND + permissions: + - teams_manage + x-unstable: '**Note**: This endpoint is in Preview. To request access, fill + out this [form](https://www.datadoghq.com/product-preview/github-integration-for-teams/). + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/team/{super_team_id}/member_teams: get: description: Get all member teams. diff --git a/cassettes/features/v2/teams/Sync-teams-returns-OK-response.frozen b/cassettes/features/v2/teams/Sync-teams-returns-OK-response.frozen new file mode 100644 index 000000000000..8723edd4fb60 --- /dev/null +++ b/cassettes/features/v2/teams/Sync-teams-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-08-15T17:48:19.712Z \ No newline at end of file diff --git a/cassettes/features/v2/teams/Sync-teams-returns-OK-response.yml b/cassettes/features/v2/teams/Sync-teams-returns-OK-response.yml new file mode 100644 index 000000000000..7b14ff86a49a --- /dev/null +++ b/cassettes/features/v2/teams/Sync-teams-returns-OK-response.yml @@ -0,0 +1,24 @@ +http_interactions: +- recorded_at: Fri, 15 Aug 2025 17:48:19 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"source":"github","type":"link"},"type":"team_sync_bulk"}}' + headers: + Accept: + - '*/*' + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team/sync + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/plain + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v2/teams/SyncTeams.rb b/examples/v2/teams/SyncTeams.rb new file mode 100644 index 000000000000..37e298cb99e3 --- /dev/null +++ b/examples/v2/teams/SyncTeams.rb @@ -0,0 +1,18 @@ +# Link Teams with GitHub Teams returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.sync_teams".to_sym] = true +end +api_instance = DatadogAPIClient::V2::TeamsAPI.new + +body = DatadogAPIClient::V2::TeamSyncRequest.new({ + data: DatadogAPIClient::V2::TeamSyncData.new({ + attributes: DatadogAPIClient::V2::TeamSyncAttributes.new({ + source: DatadogAPIClient::V2::TeamSyncAttributesSource::GITHUB, + type: DatadogAPIClient::V2::TeamSyncAttributesType::LINK, + }), + type: DatadogAPIClient::V2::TeamSyncBulkType::TEAM_SYNC_BULK, + }), +}) +p api_instance.sync_teams(body) diff --git a/examples/v2/teams/SyncTeams_3215592344.rb b/examples/v2/teams/SyncTeams_3215592344.rb new file mode 100644 index 000000000000..357b991a88e5 --- /dev/null +++ b/examples/v2/teams/SyncTeams_3215592344.rb @@ -0,0 +1,18 @@ +# Sync teams returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.sync_teams".to_sym] = true +end +api_instance = DatadogAPIClient::V2::TeamsAPI.new + +body = DatadogAPIClient::V2::TeamSyncRequest.new({ + data: DatadogAPIClient::V2::TeamSyncData.new({ + attributes: DatadogAPIClient::V2::TeamSyncAttributes.new({ + source: DatadogAPIClient::V2::TeamSyncAttributesSource::GITHUB, + type: DatadogAPIClient::V2::TeamSyncAttributesType::LINK, + }), + type: DatadogAPIClient::V2::TeamSyncBulkType::TEAM_SYNC_BULK, + }), +}) +p api_instance.sync_teams(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index de16117e642d..d01d9fa86310 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2663,6 +2663,9 @@ "v2.CreateTeam" => { "body" => "TeamCreateRequest", }, + "v2.SyncTeams" => { + "body" => "TeamSyncRequest", + }, "v2.ListMemberTeams" => { "super_team_id" => "String", "page_size" => "Integer", diff --git a/features/v2/teams.feature b/features/v2/teams.feature index 4cdf61f0fa0c..5ba9294a164f 100644 --- a/features/v2/teams.feature +++ b/features/v2/teams.feature @@ -9,7 +9,7 @@ Feature: Teams And a valid "appKeyAuth" key in the system And an instance of "Teams" API - @generated @skip @team:DataDog/core-app + @generated @skip @team:DataDog/aaa-omg Scenario: Add a member team returns "API error response." response Given operation "AddMemberTeam" enabled And new "AddMemberTeam" request @@ -18,7 +18,7 @@ Feature: Teams When the request is sent Then the response status is 409 API error response. - @generated @skip @team:DataDog/core-app + @generated @skip @team:DataDog/aaa-omg Scenario: Add a member team returns "Added" response Given operation "AddMemberTeam" enabled And new "AddMemberTeam" request @@ -27,7 +27,7 @@ Feature: Teams When the request is sent Then the response status is 204 Added - @generated @skip @team:DataDog/core-app + @generated @skip @team:DataDog/aaa-omg Scenario: Add a user to a team returns "API error response." response Given new "CreateTeamMembership" request And request contains "team_id" parameter from "REPLACE.ME" @@ -35,7 +35,7 @@ Feature: Teams When the request is sent Then the response status is 409 API error response. - @generated @skip @team:DataDog/core-app + @generated @skip @team:DataDog/aaa-omg Scenario: Add a user to a team returns "Represents a user's association to a team" response Given new "CreateTeamMembership" request And request contains "team_id" parameter from "REPLACE.ME" @@ -43,7 +43,7 @@ Feature: Teams When the request is sent Then the response status is 200 Represents a user's association to a team - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Create a team link returns "API error response." response Given new "CreateTeamLink" request And there is a valid "dd_team" in the system @@ -52,7 +52,7 @@ Feature: Teams When the request is sent Then the response status is 422 API error response. - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Create a team link returns "OK" response Given new "CreateTeamLink" request And there is a valid "dd_team" in the system @@ -64,7 +64,7 @@ Feature: Teams And the response "data.attributes.url" is equal to "https://example.com" And the response "data.attributes.position" is equal to 0 - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Create a team returns "API error response." response Given new "CreateTeam" request And there is a valid "dd_team" in the system @@ -72,7 +72,7 @@ Feature: Teams When the request is sent Then the response status is 409 API error response. - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Create a team returns "CREATED" response Given new "CreateTeam" request And body with value {"data": {"attributes": {"handle": "test-handle-{{ unique_hash }}", "name": "test-name-{{ unique_hash }}"}, "relationships": {"users": {"data": []}}, "type": "team"}} @@ -82,7 +82,7 @@ Feature: Teams And the response "data.attributes.handle" is equal to "test-handle-{{ unique_hash }}" And the response "data.attributes.name" is equal to "test-name-{{ unique_hash }}" - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Create a team with V2 fields returns "CREATED" response Given new "CreateTeam" request And body with value {"data": {"attributes": {"handle": "test-handle-{{ unique_hash }}","name": "test-name-{{ unique_hash }}", "avatar": "🥑", "banner": 7, "visible_modules": ["m1","m2"], "hidden_modules": ["m3"]}, "type": "team"}} @@ -96,7 +96,7 @@ Feature: Teams And the response "data.attributes.visible_modules" is equal to ["m1","m2"] And the response "data.attributes.hidden_modules" is equal to ["m3"] - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Get a team link returns "API error response." response Given new "GetTeamLink" request And there is a valid "dd_team" in the system @@ -105,7 +105,7 @@ Feature: Teams When the request is sent Then the response status is 404 API error response. - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Get a team link returns "OK" response Given new "GetTeamLink" request And there is a valid "dd_team" in the system @@ -115,14 +115,14 @@ Feature: Teams When the request is sent Then the response status is 200 OK - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Get a team returns "API error response." response Given new "GetTeam" request And request contains "team_id" parameter with value "REPLACE.ME" When the request is sent Then the response status is 404 API error response. - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Get a team returns "OK" response Given new "GetTeam" request And there is a valid "dd_team" in the system @@ -130,7 +130,7 @@ Feature: Teams When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/core-app + @generated @skip @team:DataDog/aaa-omg Scenario: Get all member teams returns "API error response." response Given operation "ListMemberTeams" enabled And new "ListMemberTeams" request @@ -138,7 +138,7 @@ Feature: Teams When the request is sent Then the response status is 404 API error response. - @generated @skip @team:DataDog/core-app + @generated @skip @team:DataDog/aaa-omg Scenario: Get all member teams returns "OK" response Given operation "ListMemberTeams" enabled And new "ListMemberTeams" request @@ -146,7 +146,7 @@ Feature: Teams When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/core-app @with-pagination + @generated @skip @team:DataDog/aaa-omg @with-pagination Scenario: Get all member teams returns "OK" response with pagination Given operation "ListMemberTeams" enabled And new "ListMemberTeams" request @@ -154,7 +154,7 @@ Feature: Teams When the request with pagination is sent Then the response status is 200 OK - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Get all teams returns "OK" response Given new "ListTeams" request And there is a valid "dd_team" in the system @@ -162,7 +162,7 @@ Feature: Teams Then the response status is 200 OK And the response "data" has item with field "id" with value "{{ dd_team.data.id }}" - @replay-only @skip-validation @team:DataDog/core-app @with-pagination + @replay-only @skip-validation @team:DataDog/aaa-omg @with-pagination Scenario: Get all teams returns "OK" response with pagination Given new "ListTeams" request And request contains "page[size]" parameter with value 2 @@ -170,7 +170,7 @@ Feature: Teams Then the response status is 200 OK And the response has 3 items - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Get all teams with fields_team parameter returns "OK" response Given new "ListTeams" request And there is a valid "dd_team" in the system @@ -181,14 +181,14 @@ Feature: Teams And the response "data[0].attributes" has field "name" And the response "data[0].attributes" has field "handle" - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Get links for a team returns "API error response." response Given new "GetTeamLinks" request And request contains "team_id" parameter with value "REPLACE.ME" When the request is sent Then the response status is 404 API error response. - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Get links for a team returns "OK" response Given new "GetTeamLinks" request And there is a valid "dd_team" in the system @@ -196,14 +196,14 @@ Feature: Teams When the request is sent Then the response status is 200 OK - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Get permission settings for a team returns "API error response." response Given new "GetTeamPermissionSettings" request And request contains "team_id" parameter with value "REPLACE.ME" When the request is sent Then the response status is 404 API error response. - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Get permission settings for a team returns "OK" response Given new "GetTeamPermissionSettings" request And there is a valid "dd_team" in the system @@ -211,14 +211,14 @@ Feature: Teams When the request is sent Then the response status is 200 OK - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Get team memberships returns "API error response." response Given new "GetTeamMemberships" request And request contains "team_id" parameter with value "REPLACE.ME" When the request is sent Then the response status is 404 API error response. - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Get team memberships returns "Represents a user's association to a team" response Given new "GetTeamMemberships" request And there is a valid "dd_team" in the system @@ -226,7 +226,7 @@ Feature: Teams When the request is sent Then the response status is 200 Represents a user's association to a team - @replay-only @skip-validation @team:DataDog/core-app @with-pagination + @replay-only @skip-validation @team:DataDog/aaa-omg @with-pagination Scenario: Get team memberships returns "Represents a user's association to a team" response with pagination Given new "GetTeamMemberships" request And request contains "team_id" parameter with value "2e06bf2c-193b-41d4-b3c2-afccc080458f" @@ -235,14 +235,14 @@ Feature: Teams Then the response status is 200 OK And the response has 3 items - @generated @skip @team:DataDog/core-app + @generated @skip @team:DataDog/aaa-omg Scenario: Get user memberships returns "API error response." response Given new "GetUserMemberships" request And request contains "user_uuid" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 API error response. - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Get user memberships returns "Represents a user's association to a team" response Given new "GetUserMemberships" request And there is a valid "user" in the system @@ -251,7 +251,15 @@ Feature: Teams Then the response status is 200 Represents a user's association to a team And the response "data" has length 0 - @generated @skip @team:DataDog/core-app + @generated @skip @team:DataDog/aaa-omg + Scenario: Link Teams with GitHub Teams returns "OK" response + Given operation "SyncTeams" enabled + And new "SyncTeams" request + And body with value {"data": {"attributes": {"source": "github", "type": "link"}, "type": "team_sync_bulk"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-omg Scenario: Remove a member team returns "API error response." response Given operation "RemoveMemberTeam" enabled And new "RemoveMemberTeam" request @@ -260,7 +268,7 @@ Feature: Teams When the request is sent Then the response status is 404 API error response. - @generated @skip @team:DataDog/core-app + @generated @skip @team:DataDog/aaa-omg Scenario: Remove a member team returns "No Content" response Given operation "RemoveMemberTeam" enabled And new "RemoveMemberTeam" request @@ -269,7 +277,7 @@ Feature: Teams When the request is sent Then the response status is 204 No Content - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Remove a team link returns "API error response." response Given new "DeleteTeamLink" request And there is a valid "dd_team" in the system @@ -278,7 +286,7 @@ Feature: Teams When the request is sent Then the response status is 404 API error response. - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Remove a team link returns "No Content" response Given new "DeleteTeamLink" request And there is a valid "dd_team" in the system @@ -288,14 +296,14 @@ Feature: Teams When the request is sent Then the response status is 204 No Content - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Remove a team returns "API error response." response Given new "DeleteTeam" request And request contains "team_id" parameter with value "REPLACE.ME" When the request is sent Then the response status is 404 API error response. - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Remove a team returns "No Content" response Given new "DeleteTeam" request And there is a valid "dd_team" in the system @@ -303,7 +311,7 @@ Feature: Teams When the request is sent Then the response status is 204 No Content - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Remove a user from a team returns "API error response." response Given new "DeleteTeamMembership" request And there is a valid "dd_team" in the system @@ -312,7 +320,7 @@ Feature: Teams When the request is sent Then the response status is 404 API error response. - @skip @team:DataDog/core-app + @skip @team:DataDog/aaa-omg Scenario: Remove a user from a team returns "No Content" response Given new "DeleteTeamMembership" request And there is a valid "dd_team" in the system @@ -321,7 +329,15 @@ Feature: Teams When the request is sent Then the response status is 204 No Content - @team:DataDog/core-app + @replay-only @team:DataDog/aaa-omg + Scenario: Sync teams returns "OK" response + Given new "SyncTeams" request + And operation "SyncTeams" enabled + And body with value {"data": {"attributes": {"source": "github", "type": "link"}, "type": "team_sync_bulk"}} + When the request is sent + Then the response status is 200 OK + + @team:DataDog/aaa-omg Scenario: Update a team link returns "API error response." response Given new "UpdateTeamLink" request And there is a valid "dd_team" in the system @@ -331,7 +347,7 @@ Feature: Teams When the request is sent Then the response status is 404 API error response. - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Update a team link returns "OK" response Given new "UpdateTeamLink" request And there is a valid "dd_team" in the system @@ -346,7 +362,7 @@ Feature: Teams And the response "data.attributes.label" is equal to "New Label" And the response "data.attributes.url" is equal to "https://example.com" - @generated @skip @team:DataDog/core-app + @generated @skip @team:DataDog/aaa-omg Scenario: Update a team returns "API error response." response Given new "UpdateTeam" request And request contains "team_id" parameter from "REPLACE.ME" @@ -354,7 +370,7 @@ Feature: Teams When the request is sent Then the response status is 409 API error response. - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Update a team returns "OK" response Given new "UpdateTeam" request And there is a valid "dd_team" in the system @@ -370,7 +386,7 @@ 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/core-app + @generated @skip @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" @@ -379,7 +395,7 @@ Feature: Teams When the request is sent Then the response status is 404 API error response. - @generated @skip @team:DataDog/core-app + @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 Given new "UpdateTeamMembership" request And request contains "team_id" parameter from "REPLACE.ME" @@ -388,7 +404,7 @@ Feature: Teams When the request is sent Then the response status is 200 Represents a user's association to a team - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Update a user's role on a team returns "API error response." response Given new "UpdateTeamMembership" request And there is a valid "dd_team" in the system @@ -398,7 +414,7 @@ Feature: Teams When the request is sent Then the response status is 404 API error response. - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Update permission setting for team returns "API error response." response Given new "UpdateTeamPermissionSetting" request And there is a valid "dd_team" in the system @@ -408,7 +424,7 @@ Feature: Teams When the request is sent Then the response status is 404 API error response. - @team:DataDog/core-app + @team:DataDog/aaa-omg Scenario: Update permission setting for team returns "OK" response Given new "UpdateTeamPermissionSetting" request And there is a valid "dd_team" in the system diff --git a/features/v2/undo.json b/features/v2/undo.json index fd14fad09365..6f5c5499f1cf 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -3411,6 +3411,12 @@ "type": "unsafe" } }, + "SyncTeams": { + "tag": "Teams", + "undo": { + "type": "idempotent" + } + }, "ListMemberTeams": { "tag": "Teams", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index d3af1c434f86..d50a8a700689 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -277,6 +277,7 @@ def initialize "v2.add_member_team": false, "v2.list_member_teams": false, "v2.remove_member_team": false, + "v2.sync_teams": false, "v2.create_incident_team": false, "v2.delete_incident_team": false, "v2.get_incident_team": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index f308b274bb02..8ede17cd2cc2 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3651,6 +3651,12 @@ def overrides "v2.teams_response_links" => "TeamsResponseLinks", "v2.teams_response_meta" => "TeamsResponseMeta", "v2.teams_response_meta_pagination" => "TeamsResponseMetaPagination", + "v2.team_sync_attributes" => "TeamSyncAttributes", + "v2.team_sync_attributes_source" => "TeamSyncAttributesSource", + "v2.team_sync_attributes_type" => "TeamSyncAttributesType", + "v2.team_sync_bulk_type" => "TeamSyncBulkType", + "v2.team_sync_data" => "TeamSyncData", + "v2.team_sync_request" => "TeamSyncRequest", "v2.team_target" => "TeamTarget", "v2.team_target_type" => "TeamTargetType", "v2.team_type" => "TeamType", diff --git a/lib/datadog_api_client/v2/api/teams_api.rb b/lib/datadog_api_client/v2/api/teams_api.rb index 82d3d6db7cbe..6881dd06e99b 100644 --- a/lib/datadog_api_client/v2/api/teams_api.rb +++ b/lib/datadog_api_client/v2/api/teams_api.rb @@ -1225,6 +1225,89 @@ def remove_member_team_with_http_info(super_team_id, member_team_id, opts = {}) return data, status_code, headers end + # Link Teams with GitHub Teams. + # + # @see #sync_teams_with_http_info + def sync_teams(body, opts = {}) + sync_teams_with_http_info(body, opts) + nil + end + + # Link Teams with GitHub Teams. + # + # This endpoint attempts to link your existing Datadog teams with GitHub teams by matching their names. + # It evaluates all current Datadog teams and compares them against teams in the GitHub organization + # connected to your Datadog account, based on Datadog Team handle and GitHub Team slug + # (lowercased and kebab-cased). + # + # This operation is read-only on the GitHub side, no teams will be modified or created. + # + # [A GitHub organization must be connected to your Datadog account](https://docs.datadoghq.com/integrations/github/), + # and the GitHub App integrated with Datadog must have the `Members Read` permission. Matching is performed by comparing the Datadog team handle to the GitHub team slug + # using a normalized exact match; case is ignored and spaces are removed. No modifications are made + # to teams in GitHub. This will not create new Teams in Datadog. + # + # @param body [TeamSyncRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def sync_teams_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.sync_teams".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.sync_teams") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.sync_teams")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TeamsAPI.sync_teams ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling TeamsAPI.sync_teams" + end + # resource path + local_var_path = '/api/v2/team/sync' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :sync_teams, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TeamsAPI#sync_teams\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update a team. # # @see #update_team_with_http_info diff --git a/lib/datadog_api_client/v2/models/team_sync_attributes.rb b/lib/datadog_api_client/v2/models/team_sync_attributes.rb new file mode 100644 index 000000000000..b9711f17799c --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_sync_attributes.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Team sync attributes. + class TeamSyncAttributes + include BaseGenericModel + + # The external source platform for team synchronization. Only "github" is supported. + attr_reader :source + + # The type of synchronization operation. Only "link" is supported, which links existing teams by matching names. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'source' => :'source', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'source' => :'TeamSyncAttributesSource', + :'type' => :'TeamSyncAttributesType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamSyncAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'source') + self.source = attributes[:'source'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @source.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param source [Object] Object to be assigned + # @!visibility private + def source=(source) + if source.nil? + fail ArgumentError, 'invalid value for "source", source cannot be nil.' + end + @source = source + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + source == o.source && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [source, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_sync_attributes_source.rb b/lib/datadog_api_client/v2/models/team_sync_attributes_source.rb new file mode 100644 index 000000000000..9073dba4659e --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_sync_attributes_source.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The external source platform for team synchronization. Only "github" is supported. + class TeamSyncAttributesSource + include BaseEnumModel + + GITHUB = "github".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/team_sync_attributes_type.rb b/lib/datadog_api_client/v2/models/team_sync_attributes_type.rb new file mode 100644 index 000000000000..0765da40a2ee --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_sync_attributes_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of synchronization operation. Only "link" is supported, which links existing teams by matching names. + class TeamSyncAttributesType + include BaseEnumModel + + LINK = "link".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/team_sync_bulk_type.rb b/lib/datadog_api_client/v2/models/team_sync_bulk_type.rb new file mode 100644 index 000000000000..ba3c736439eb --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_sync_bulk_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Team sync bulk type. + class TeamSyncBulkType + include BaseEnumModel + + TEAM_SYNC_BULK = "team_sync_bulk".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/team_sync_data.rb b/lib/datadog_api_client/v2/models/team_sync_data.rb new file mode 100644 index 000000000000..3126a6e756aa --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_sync_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Team sync data. + class TeamSyncData + include BaseGenericModel + + # Team sync attributes. + attr_reader :attributes + + # Team sync bulk type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TeamSyncAttributes', + :'type' => :'TeamSyncBulkType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamSyncData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_sync_request.rb b/lib/datadog_api_client/v2/models/team_sync_request.rb new file mode 100644 index 000000000000..5e26ac8d02ef --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_sync_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Team sync request. + class TeamSyncRequest + include BaseGenericModel + + # Team sync data. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TeamSyncData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamSyncRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end