Documentation
¶
Overview ¶
Package cncf provides functionality for interacting with the Cloud Native Computing Foundation (CNCF) landscape.
The package allows fetching and querying the official CNCF landscape data, which contains information about all CNCF projects, their status, and related metadata. It includes built-in caching to minimize network requests and provides a simple interface for finding projects by various identifiers.
Basic usage:
client := &cncf.DefaultHTTPClient{}
landscape, err := cncf.GetLandscape(client)
if err != nil {
// Handle error
}
// Find a project
project := landscape.FindProject(cncf.FindProjectOptions{
Name: "Kubernetes",
})
The landscape data is automatically cached for one hour (configurable via CacheTTL) to reduce network requests and improve performance.
Projects can be found by:
- Repository URL
- Homepage URL
- Project name (case-insensitive matching)
Index ¶
Constants ¶
const ( LandscapeURL = "https://raw.githubusercontent.com/cncf/landscape/master/landscape.yml" CacheTTL = 1 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category struct {
Name string `yaml:"name"`
Subcategories []Subcategory `yaml:"subcategories"`
}
type DefaultHTTPClient ¶
type DefaultHTTPClient struct{}
DefaultHTTPClient is the default implementation of HTTPClient that uses http.Get.
type FindProjectOptions ¶
type HTTPClient ¶
HTTPClient is an interface that abstracts the http.Get function.
type Landscape ¶
type Landscape struct {
Categories []Category `yaml:"landscape"`
}
func GetLandscape ¶
func GetLandscape(client HTTPClient) (*Landscape, error)
GetLandscape fetches the CNCF landscape from the official repository
func (*Landscape) FindProject ¶
func (l *Landscape) FindProject(opts FindProjectOptions) *Project
FindProject finds a project in the landscape by repo URL, homepage URL, or name.