Skip to content

Add a new endpoint for listing Software Catalog relations #2361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-05-02 04:31:13.587503",
"spec_repo_commit": "272cce39"
"regenerated": "2025-05-02 16:32:07.534233",
"spec_repo_commit": "f88cc028"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-05-02 04:31:13.603582",
"spec_repo_commit": "272cce39"
"regenerated": "2025-05-02 16:32:07.549905",
"spec_repo_commit": "f88cc028"
}
}
}
217 changes: 217 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ components:
type: string
FilterByRef:
description: Filter entities by reference
example: service:shopping-cart
explode: true
in: query
name: filter[ref]
Expand All @@ -349,6 +350,32 @@ components:
required: false
schema:
$ref: '#/components/schemas/RelationType'
FilterRelationByFromRef:
description: Filter relations by the reference of the first entity in the relation.
example: service:shopping-cart
explode: true
in: query
name: filter[from_ref]
required: false
schema:
type: string
FilterRelationByToRef:
description: Filter relations by the reference of the second entity in the relation.
example: service:shopping-cart
explode: true
in: query
name: filter[to_ref]
required: false
schema:
type: string
FilterRelationByType:
description: Filter relations by type.
explode: true
in: query
name: filter[type]
required: false
schema:
$ref: '#/components/schemas/RelationType'
GCPSTSServiceAccountID:
description: Your GCP STS enabled service account's unique ID.
in: path
Expand Down Expand Up @@ -659,6 +686,14 @@ components:
required: true
schema:
type: string
RelationInclude:
description: Include relationship data.
explode: true
in: query
name: include
required: false
schema:
$ref: '#/components/schemas/RelationIncludeType'
ReportID:
description: The ID of the report job.
in: path
Expand Down Expand Up @@ -19254,6 +19289,38 @@ components:
meta:
$ref: '#/components/schemas/PowerpacksResponseMeta'
type: object
ListRelationCatalogResponse:
description: List entity relation response.
properties:
data:
$ref: '#/components/schemas/RelationResponseData'
included:
$ref: '#/components/schemas/ListRelationCatalogResponseIncluded'
links:
$ref: '#/components/schemas/ListRelationCatalogResponseLinks'
meta:
$ref: '#/components/schemas/RelationResponseMeta'
type: object
ListRelationCatalogResponseIncluded:
description: List relation response included entities.
items:
$ref: '#/components/schemas/EntityData'
type: array
ListRelationCatalogResponseLinks:
description: List relation response links.
properties:
next:
description: Next link.
example: /api/v2/catalog/relation?filter[from_ref]=service:service-catalog&include=entity&page[limit]=2&page[offset]=2
type: string
previous:
description: Previous link.
type: string
self:
description: Current link.
example: /api/v2/catalog/relation?filter[from_ref]=service:service-catalog&include=entity&page[limit]=2&page[offset]=0
type: string
type: object
ListRulesResponse:
description: Scorecard rules response.
properties:
Expand Down Expand Up @@ -28556,6 +28623,114 @@ components:
x-enum-varnames:
- ANY
- ALL
RelationAttributes:
description: Relation attributes.
properties:
from:
$ref: '#/components/schemas/RelationEntity'
to:
$ref: '#/components/schemas/RelationEntity'
type:
$ref: '#/components/schemas/RelationType'
type: object
RelationEntity:
description: Relation entity reference.
properties:
kind:
description: Entity kind.
type: string
name:
description: Entity name.
type: string
namespace:
description: Entity namespace.
type: string
type: object
RelationIncludeType:
description: Supported include types for relations.
enum:
- entity
- schema
type: string
x-enum-varnames:
- ENTITY
- SCHEMA
RelationMeta:
description: Relation metadata.
properties:
createdAt:
description: Relation creation time.
format: date-time
type: string
definedBy:
description: Relation defined by.
type: string
modifiedAt:
description: Relation modification time.
format: date-time
type: string
source:
description: Relation source.
type: string
type: object
RelationRelationships:
description: Relation relationships.
properties:
fromEntity:
$ref: '#/components/schemas/RelationToEntity'
toEntity:
$ref: '#/components/schemas/RelationToEntity'
type: object
RelationResponse:
description: Relation response data.
properties:
attributes:
$ref: '#/components/schemas/RelationAttributes'
id:
description: Relation ID.
type: string
meta:
$ref: '#/components/schemas/RelationMeta'
relationships:
$ref: '#/components/schemas/RelationRelationships'
subtype:
description: Relation subtype.
type: string
type:
$ref: '#/components/schemas/RelationResponseType'
type: object
RelationResponseData:
description: Array of relation responses
items:
$ref: '#/components/schemas/RelationResponse'
type: array
RelationResponseMeta:
description: Relation response metadata.
properties:
count:
description: Total relations count.
format: int64
type: integer
includeCount:
description: Total included data count.
format: int64
type: integer
type: object
RelationResponseType:
description: Relation type.
enum:
- relation
type: string
x-enum-varnames:
- RELATION
RelationToEntity:
description: Relation to entity.
properties:
data:
$ref: '#/components/schemas/RelationshipItem'
meta:
$ref: '#/components/schemas/EntityMeta'
type: object
RelationType:
description: Supported relation types.
enum:
Expand Down Expand Up @@ -42634,6 +42809,48 @@ paths:
summary: Delete a single entity
tags:
- Software Catalog
/api/v2/catalog/relation:
get:
description: Get a list of entity relations from Software Catalog.
operationId: ListCatalogRelation
parameters:
- $ref: '#/components/parameters/PageOffset'
- description: Maximum number of relations in the response.
example: 100
in: query
name: page[limit]
required: false
schema:
default: 100
format: int64
type: integer
- $ref: '#/components/parameters/FilterRelationByType'
- $ref: '#/components/parameters/FilterRelationByFromRef'
- $ref: '#/components/parameters/FilterRelationByToRef'
- $ref: '#/components/parameters/RelationInclude'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ListRelationCatalogResponse'
description: OK
'403':
$ref: '#/components/responses/ForbiddenResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- apm_service_catalog_read
summary: Get a list of entity relations
tags:
- Software Catalog
x-pagination:
limitParam: page[limit]
pageOffsetParam: page[offset]
resultsPath: data
/api/v2/ci/pipeline:
post:
description: 'Send your pipeline event to your Datadog platform over HTTP. For
Expand Down
5 changes: 5 additions & 0 deletions examples/v2/software-catalog/ListCatalogRelation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Get a list of entity relations returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::SoftwareCatalogAPI.new
p api_instance.list_catalog_relation()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Violation

Suggested change
p api_instance.list_catalog_relation()
p api_instance.list_catalog_relation
Do not use parentheses with methods that take no arguments (...read more)

The rule "Avoid parentheses when methods take no arguments" is part of the Ruby style guide. It suggests that when a method takes no arguments, you should not use parentheses. This is because the use of parentheses in such a case is redundant and unnecessary, and it can make your code more difficult to read and understand.

This rule is important because it promotes cleaner, more readable code. In Ruby, clean and readable code is highly valued. By following this rule, you can ensure your code is easier to understand and maintain, which is crucial for long-term project success.

To adhere to this rule, remove the parentheses when calling a method that does not require any arguments. For example, instead of writing 'test'.upcase(), you should write 'test'.upcase. Similarly, instead of Kernel.exit!(), write Kernel.exit!. However, note that there is an exception for super - super by itself is different from super(), so in this case, parentheses may be necessary.

View in Datadog  Leave us feedback  Documentation

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Get a list of entity relations returns "OK" response with pagination

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::SoftwareCatalogAPI.new
api_instance.list_catalog_relation_with_pagination() { |item| puts item }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Violation

Suggested change
api_instance.list_catalog_relation_with_pagination() { |item| puts item }
api_instance.list_catalog_relation_with_pagination { |item| puts item }
Do not use parentheses with methods that take no arguments (...read more)

The rule "Avoid parentheses when methods take no arguments" is part of the Ruby style guide. It suggests that when a method takes no arguments, you should not use parentheses. This is because the use of parentheses in such a case is redundant and unnecessary, and it can make your code more difficult to read and understand.

This rule is important because it promotes cleaner, more readable code. In Ruby, clean and readable code is highly valued. By following this rule, you can ensure your code is easier to understand and maintain, which is crucial for long-term project success.

To adhere to this rule, remove the parentheses when calling a method that does not require any arguments. For example, instead of writing 'test'.upcase(), you should write 'test'.upcase. Similarly, instead of Kernel.exit!(), write Kernel.exit!. However, note that there is an exception for super - super by itself is different from super(), so in this case, parentheses may be necessary.

View in Datadog  Leave us feedback  Documentation

8 changes: 8 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,14 @@
"v2.DeleteCatalogEntity" => {
"entity_id" => "String",
},
"v2.ListCatalogRelation" => {
"page_offset" => "Integer",
"page_limit" => "Integer",
"filter_type" => "RelationType",
"filter_from_ref" => "String",
"filter_to_ref" => "String",
"include" => "RelationIncludeType",
},
Comment on lines +1109 to +1116

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Violation

Consider using symbols instead of string hash keys (...read more)

In Ruby, it is a best practice to use symbols instead of strings as hash keys. This rule emphasizes that it's more efficient and idiomatic to use symbols for this purpose. Symbols are immutable and unique, which makes them ideal for identifying things, whereas strings are mutable and can create multiple objects for the same sequence of characters.

The importance of this rule lies in the performance and memory usage of your Ruby application. Using symbols as hash keys reduces memory usage because they are stored in memory only once during a Ruby process. This can make a significant difference in the efficiency of your application, especially when dealing with large data sets.

To ensure you're following good coding practices, always use symbols for hash keys unless there's a specific reason to use a string. A simple refactoring from values = { 'foo' => 42, 'bar' => 99, 'baz' => 123 } to values = { foo: 42, bar: 99, baz: 123 } will make your code compliant with this rule. This not only improves your code's performance but also makes it more readable and consistent with Ruby's conventions.

View in Datadog  Leave us feedback  Documentation

"v2.CreateCIAppPipelineEvent" => {
"body" => "CIAppCreatePipelineEventRequest",
},
Expand Down
12 changes: 12 additions & 0 deletions features/v2/software_catalog.feature
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,15 @@ Feature: Software Catalog
Given new "ListCatalogEntity" request
When the request with pagination is sent
Then the response status is 200 OK

@team:DataDog/service-catalog
Scenario: Get a list of entity relations returns "OK" response
Given new "ListCatalogRelation" request
When the request is sent
Then the response status is 200 OK

@team:DataDog/service-catalog @with-pagination
Scenario: Get a list of entity relations returns "OK" response with pagination
Given new "ListCatalogRelation" request
When the request with pagination is sent
Then the response status is 200 OK
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,12 @@
"type": "idempotent"
}
},
"ListCatalogRelation": {
"tag": "Software Catalog",
"undo": {
"type": "safe"
}
},
"CreateCIAppPipelineEvent": {
"tag": "CI Visibility Pipelines",
"undo": {
Expand Down
11 changes: 11 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2072,6 +2072,8 @@ def overrides
"v2.list_pipelines_response" => "ListPipelinesResponse",
"v2.list_pipelines_response_meta" => "ListPipelinesResponseMeta",
"v2.list_powerpacks_response" => "ListPowerpacksResponse",
"v2.list_relation_catalog_response" => "ListRelationCatalogResponse",
"v2.list_relation_catalog_response_links" => "ListRelationCatalogResponseLinks",
"v2.list_rules_response" => "ListRulesResponse",
"v2.list_rules_response_data_item" => "ListRulesResponseDataItem",
"v2.list_rules_response_links" => "ListRulesResponseLinks",
Expand Down Expand Up @@ -2624,6 +2626,14 @@ def overrides
"v2.query_sort_order" => "QuerySortOrder",
"v2.readiness_gate" => "ReadinessGate",
"v2.readiness_gate_threshold_type" => "ReadinessGateThresholdType",
"v2.relation_attributes" => "RelationAttributes",
"v2.relation_entity" => "RelationEntity",
"v2.relation_include_type" => "RelationIncludeType",
"v2.relation_meta" => "RelationMeta",
"v2.relation_relationships" => "RelationRelationships",
"v2.relation_response" => "RelationResponse",
"v2.relation_response_meta" => "RelationResponseMeta",
"v2.relation_response_type" => "RelationResponseType",
"v2.relationship_item" => "RelationshipItem",
"v2.relationship_to_incident_attachment" => "RelationshipToIncidentAttachment",
"v2.relationship_to_incident_attachment_data" => "RelationshipToIncidentAttachmentData",
Expand Down Expand Up @@ -2666,6 +2676,7 @@ def overrides
"v2.relationship_to_user_team_team_data" => "RelationshipToUserTeamTeamData",
"v2.relationship_to_user_team_user" => "RelationshipToUserTeamUser",
"v2.relationship_to_user_team_user_data" => "RelationshipToUserTeamUserData",
"v2.relation_to_entity" => "RelationToEntity",
"v2.relation_type" => "RelationType",
"v2.remediation" => "Remediation",
"v2.reorder_retention_filters_request" => "ReorderRetentionFiltersRequest",
Expand Down
Loading
Loading