Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@backstage/catalog-client
Advanced tools
An isomorphic client for the catalog backend
@backstage/catalog-client is a client library for interacting with the Backstage catalog, which is a centralized service catalog for managing all your software components, APIs, and other entities. It allows you to programmatically interact with the catalog to perform operations such as retrieving entities, adding new entities, and searching for entities.
Retrieve Entities
This feature allows you to retrieve all entities from the Backstage catalog. The code sample demonstrates how to create a CatalogClient instance and use it to fetch entities.
const { CatalogClient } = require('@backstage/catalog-client');
const client = new CatalogClient({ discoveryApi });
async function getEntities() {
const entities = await client.getEntities();
console.log(entities);
}
getEntities();
Add New Entity
This feature allows you to add a new entity to the Backstage catalog. The code sample demonstrates how to create a new entity object and use the CatalogClient to add it to the catalog.
const { CatalogClient } = require('@backstage/catalog-client');
const client = new CatalogClient({ discoveryApi });
async function addEntity(entity) {
const response = await client.addEntity(entity);
console.log(response);
}
const newEntity = {
apiVersion: 'backstage.io/v1alpha1',
kind: 'Component',
metadata: {
name: 'my-component',
},
spec: {
type: 'service',
lifecycle: 'production',
owner: 'team-a',
},
};
addEntity(newEntity);
Search Entities
This feature allows you to search for entities in the Backstage catalog based on specific criteria. The code sample demonstrates how to create a query object and use the CatalogClient to search for entities that match the query.
const { CatalogClient } = require('@backstage/catalog-client');
const client = new CatalogClient({ discoveryApi });
async function searchEntities(query) {
const entities = await client.getEntities({ filter: query });
console.log(entities);
}
const query = { kind: 'Component', 'metadata.name': 'my-component' };
searchEntities(query);
The kubernetes-client package provides a client for interacting with the Kubernetes API. It allows you to manage Kubernetes resources programmatically, similar to how @backstage/catalog-client allows you to manage Backstage catalog entities. However, kubernetes-client is specific to Kubernetes resources and does not provide the same level of abstraction for software components and APIs as @backstage/catalog-client.
The octokit package is a client library for interacting with the GitHub API. It allows you to manage GitHub repositories, issues, pull requests, and other resources programmatically. While it provides similar functionality in terms of managing resources, it is specific to GitHub and does not offer the same centralized service catalog capabilities as @backstage/catalog-client.
The aws-sdk package is a client library for interacting with various AWS services. It allows you to manage AWS resources such as EC2 instances, S3 buckets, and Lambda functions programmatically. While it provides similar functionality in terms of managing resources, it is specific to AWS services and does not offer the same centralized service catalog capabilities as @backstage/catalog-client.
Contains a frontend and backend compatible client for communicating with the Backstage Catalog.
Backend code may import and use this package directly.
However, frontend code will not want to instantiate a catalog client directly -
use the @backstage/plugin-catalog-react
package instead, which exports a
catalogApiRef
that can be leveraged like other frontend utility APIs.
FAQs
An isomorphic client for the catalog backend
We found that @backstage/catalog-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.