Skip to content

Add a new endpoint for listing Software Catalog relations #2200

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:15.271278",
"spec_repo_commit": "272cce39"
"regenerated": "2025-05-02 16:32:14.390117",
"spec_repo_commit": "f88cc028"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-05-02 04:31:15.291066",
"spec_repo_commit": "272cce39"
"regenerated": "2025-05-02 16:32:14.406439",
"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
17 changes: 17 additions & 0 deletions examples/v2/software-catalog/ListCatalogRelation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Get a list of entity relations returns "OK" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.SoftwareCatalogApi(configuration);

apiInstance
.listCatalogRelation()
.then((data: v2.ListRelationCatalogResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
18 changes: 18 additions & 0 deletions examples/v2/software-catalog/ListCatalogRelation_1311054087.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Get a list of entity relations returns "OK" response with pagination
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.SoftwareCatalogApi(configuration);

(async () => {
try {
for await (const item of apiInstance.listCatalogRelationWithPagination()) {
console.log(item);
}
} catch (error) {
console.error(error);
}
})();
27 changes: 27 additions & 0 deletions features/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3097,6 +3097,33 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
},
"operationResponseType": "void",
},
"v2.ListCatalogRelation": {
"pageOffset": {
"type": "number",
"format": "int64",
},
"pageLimit": {
"type": "number",
"format": "int64",
},
"filterType": {
"type": "RelationType",
"format": "",
},
"filterFromRef": {
"type": "string",
"format": "",
},
"filterToRef": {
"type": "string",
"format": "",
},
"include": {
"type": "RelationIncludeType",
"format": "",
},
"operationResponseType": "ListRelationCatalogResponse",
},
"v2.CreateCIAppPipelineEvent": {
"body": {
"type": "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
Loading
Loading