Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
437 changes: 437 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions examples/v2/team-connections/CreateTeamConnections.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Create team connections returns "Created" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.create_team_connections".to_sym] = true
end
api_instance = DatadogAPIClient::V2::TeamConnectionsAPI.new

# there is a valid "dd_team" in the system
DD_TEAM_DATA_ID = ENV["DD_TEAM_DATA_ID"]

body = DatadogAPIClient::V2::TeamConnectionCreateRequest.new({
data: [
DatadogAPIClient::V2::TeamConnectionCreateData.new({
type: DatadogAPIClient::V2::TeamConnectionType::TEAM_CONNECTION,
attributes: DatadogAPIClient::V2::TeamConnectionAttributes.new({
source: "github",
managed_by: "datadog",
}),
relationships: DatadogAPIClient::V2::TeamConnectionRelationships.new({
team: DatadogAPIClient::V2::TeamRef.new({
data: DatadogAPIClient::V2::TeamRefData.new({
id: DD_TEAM_DATA_ID,
type: DatadogAPIClient::V2::TeamRefDataType::TEAM,
}),
}),
connected_team: DatadogAPIClient::V2::ConnectedTeamRef.new({
data: DatadogAPIClient::V2::ConnectedTeamRefData.new({
id: "@MyGitHubAccount/my-team-name",
type: DatadogAPIClient::V2::ConnectedTeamRefDataType::GITHUB_TEAM,
}),
}),
}),
}),
],
})
p api_instance.create_team_connections(body)
20 changes: 20 additions & 0 deletions examples/v2/team-connections/DeleteTeamConnections.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Delete team connections returns "No Content" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.delete_team_connections".to_sym] = true
end
api_instance = DatadogAPIClient::V2::TeamConnectionsAPI.new

# there is a valid "team_connection" in the system
TEAM_CONNECTION_ID = ENV["TEAM_CONNECTION_ID"]

body = DatadogAPIClient::V2::TeamConnectionDeleteRequest.new({
data: [
DatadogAPIClient::V2::TeamConnectionDeleteRequestDataItems.new({
id: TEAM_CONNECTION_ID,
type: DatadogAPIClient::V2::TeamConnectionType::TEAM_CONNECTION,
}),
],
})
api_instance.delete_team_connections(body)
8 changes: 8 additions & 0 deletions examples/v2/team-connections/ListTeamConnections.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# List team connections returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.list_team_connections".to_sym] = true
end
api_instance = DatadogAPIClient::V2::TeamConnectionsAPI.new
p api_instance.list_team_connections()
14 changes: 14 additions & 0 deletions examples/v2/team-connections/ListTeamConnections_1473516764.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# List team connections with filters returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.list_team_connections".to_sym] = true
end
api_instance = DatadogAPIClient::V2::TeamConnectionsAPI.new
opts = {
filter_sources: [
"github",
],
page_size: 10,
}
p api_instance.list_team_connections(opts)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# List team connections returns "OK" response with pagination

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.list_team_connections".to_sym] = true
end
api_instance = DatadogAPIClient::V2::TeamConnectionsAPI.new
api_instance.list_team_connections_with_pagination() { |item| puts item }
16 changes: 16 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2998,6 +2998,22 @@
"v2.GetUserMemberships" => {
"user_uuid" => "String",
},
"v2.DeleteTeamConnections" => {
"body" => "TeamConnectionDeleteRequest",
},
"v2.ListTeamConnections" => {
"page_size" => "Integer",
"page_number" => "Integer",
"page_offset" => "Integer",
"page_limit" => "Integer",
"filter_sources" => "Array<String>",
"filter_team_ids" => "Array<String>",
"filter_connected_team_ids" => "Array<String>",
"filter_connection_ids" => "Array<String>",
},
"v2.CreateTeamConnections" => {
"body" => "TeamConnectionCreateRequest",
},
"v2.ListIncidentTeams" => {
"include" => "IncidentRelatedObject",
"page_size" => "Integer",
Expand Down
7 changes: 7 additions & 0 deletions features/v2/given.json
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,13 @@
"tag": "Teams",
"operationId": "CreateTeam"
},
{
"source": "data.data[0]",
"step": "there is a valid \"team_connection\" in the system",
"key": "team_connection",
"tag": "Team Connections",
"operationId": "CreateTeamConnections"
},
{
"parameters": [
{
Expand Down
95 changes: 95 additions & 0 deletions features/v2/team_connections.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
@endpoint(team-connections) @endpoint(team-connections-v2)
Feature: Team Connections
View and manage relationships between Datadog teams and teams from
external sources, such as GitHub.

Background:
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "TeamConnections" API

@team:DataDog/aaa-omg
Scenario: Create team connections returns "Bad Request" response
Given operation "CreateTeamConnections" enabled
And new "CreateTeamConnections" request
And body with value {"data": [{"attributes": {"source": "github"}, "relationships": {"connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}, "team": {"data": {"type": "team"}}}, "type": "team_connection"}]}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/aaa-omg
Scenario: Create team connections returns "Conflict" response
Given operation "CreateTeamConnections" enabled
And new "CreateTeamConnections" request
And body with value {"data": [{"attributes": {"managed_by": "github_sync", "source": "github"}, "relationships": {"connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}, "team": {"data": {"id": "87654321-4321-8765-dcba-210987654321", "type": "team"}}}, "type": "team_connection"}]}
When the request is sent
Then the response status is 409 Conflict

@team:DataDog/aaa-omg
Scenario: Create team connections returns "Created" response
Given operation "CreateTeamConnections" enabled
And new "CreateTeamConnections" request
And there is a valid "dd_team" in the system
And body with value {"data": [{"type": "team_connection", "attributes": {"source": "github", "managed_by": "datadog"}, "relationships": {"team": {"data": {"id": "{{ dd_team.data.id }}", "type": "team"}}, "connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}}}]}
When the request is sent
Then the response status is 201 Created
And the response "data.data[0].attributes.source" is equal to "github"
And the response "data.data[0].attributes.managed_by" is equal to "datadog"
And the response "data.data[0].relationships.team.data.id" is equal to "{{ dd_team.data.id }}"
And the response "data.data[0].relationships.connected_team.data.id" is equal to "@MyGitHubAccount/my-team-name"
And the response "data.data[0].type" is equal to "team_connection"

@team:DataDog/aaa-omg
Scenario: Delete team connections returns "Bad Request" response
Given operation "DeleteTeamConnections" enabled
And new "DeleteTeamConnections" request
And body with value {"data": [{"type": "team_connection"}]}
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/aaa-omg
Scenario: Delete team connections returns "No Content" response
Given operation "DeleteTeamConnections" enabled
And new "DeleteTeamConnections" request
And there is a valid "dd_team" in the system
And there is a valid "team_connection" in the system
And body with value {"data": [{"id": "{{ team_connection.id }}", "type": "team_connection"}]}
When the request is sent
Then the response status is 204 No Content

@generated @skip @team:DataDog/aaa-omg
Scenario: Delete team connections returns "Not Found" response
Given operation "DeleteTeamConnections" enabled
And new "DeleteTeamConnections" request
And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/aaa-omg
Scenario: List team connections returns "Bad Request" response
Given operation "ListTeamConnections" enabled
And new "ListTeamConnections" request
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/aaa-omg
Scenario: List team connections returns "OK" response
Given operation "ListTeamConnections" enabled
And new "ListTeamConnections" request
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/aaa-omg @with-pagination
Scenario: List team connections returns "OK" response with pagination
Given operation "ListTeamConnections" enabled
And new "ListTeamConnections" request
When the request with pagination is sent
Then the response status is 200 OK

@team:DataDog/aaa-omg
Scenario: List team connections with filters returns "OK" response
Given operation "ListTeamConnections" enabled
And new "ListTeamConnections" request
And request contains "filter[sources]" parameter with value ["github"]
And request contains "page[size]" parameter with value 10
When the request is sent
Then the response status is 200 OK
19 changes: 19 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3902,6 +3902,25 @@
"type": "unsafe"
}
},
"DeleteTeamConnections": {
"tag": "Team Connections",
"undo": {
"type": "idempotent"
}
},
"ListTeamConnections": {
"tag": "Team Connections",
"undo": {
"type": "safe"
}
},
"CreateTeamConnections": {
"tag": "Team Connections",
"undo": {
"operationId": "DeleteTeamConnections",
"type": "unsafe"
}
},
"SyncTeams": {
"tag": "Teams",
"undo": {
Expand Down
3 changes: 3 additions & 0 deletions lib/datadog_api_client/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ def initialize
"v2.list_member_teams": false,
"v2.remove_member_team": false,
"v2.sync_teams": false,
"v2.create_team_connections": false,
"v2.delete_team_connections": false,
"v2.list_team_connections": false,
"v2.create_incident_team": false,
"v2.delete_incident_team": false,
"v2.get_incident_team": false,
Expand Down
18 changes: 18 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1538,10 +1538,14 @@ def overrides
"v2.confluent_resource_response_data" => "ConfluentResourceResponseData",
"v2.confluent_resources_response" => "ConfluentResourcesResponse",
"v2.confluent_resource_type" => "ConfluentResourceType",
"v2.connected_team_ref" => "ConnectedTeamRef",
"v2.connected_team_ref_data" => "ConnectedTeamRefData",
"v2.connected_team_ref_data_type" => "ConnectedTeamRefDataType",
"v2.connection" => "Connection",
"v2.connection_env" => "ConnectionEnv",
"v2.connection_env_env" => "ConnectionEnvEnv",
"v2.connection_group" => "ConnectionGroup",
"v2.connections_response_meta" => "ConnectionsResponseMeta",
"v2.container" => "Container",
"v2.container_attributes" => "ContainerAttributes",
"v2.container_group" => "ContainerGroup",
Expand Down Expand Up @@ -3945,6 +3949,16 @@ def overrides
"v2.tag_filter" => "TagFilter",
"v2.team" => "Team",
"v2.team_attributes" => "TeamAttributes",
"v2.team_connection" => "TeamConnection",
"v2.team_connection_attributes" => "TeamConnectionAttributes",
"v2.team_connection_create_data" => "TeamConnectionCreateData",
"v2.team_connection_create_request" => "TeamConnectionCreateRequest",
"v2.team_connection_delete_request" => "TeamConnectionDeleteRequest",
"v2.team_connection_delete_request_data_items" => "TeamConnectionDeleteRequestDataItems",
"v2.team_connection_relationships" => "TeamConnectionRelationships",
"v2.team_connections_list" => "TeamConnectionsList",
"v2.team_connections_response" => "TeamConnectionsResponse",
"v2.team_connection_type" => "TeamConnectionType",
"v2.team_create" => "TeamCreate",
"v2.team_create_attributes" => "TeamCreateAttributes",
"v2.team_create_relationships" => "TeamCreateRelationships",
Expand Down Expand Up @@ -3978,6 +3992,9 @@ def overrides
"v2.team_permission_setting_update_attributes" => "TeamPermissionSettingUpdateAttributes",
"v2.team_permission_setting_update_request" => "TeamPermissionSettingUpdateRequest",
"v2.team_permission_setting_value" => "TeamPermissionSettingValue",
"v2.team_ref" => "TeamRef",
"v2.team_ref_data" => "TeamRefData",
"v2.team_ref_data_type" => "TeamRefDataType",
"v2.team_reference" => "TeamReference",
"v2.team_reference_attributes" => "TeamReferenceAttributes",
"v2.team_reference_type" => "TeamReferenceType",
Expand Down Expand Up @@ -4307,6 +4324,7 @@ def overrides
"v2.spans_api" => "SpansAPI",
"v2.spans_metrics_api" => "SpansMetricsAPI",
"v2.synthetics_api" => "SyntheticsAPI",
"v2.team_connections_api" => "TeamConnectionsAPI",
"v2.teams_api" => "TeamsAPI",
"v2.test_optimization_api" => "TestOptimizationAPI",
"v2.usage_metering_api" => "UsageMeteringAPI",
Expand Down
Loading
Loading