cortex

package
v0.0.0-...-c0abbfe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBaseURL = "https://api.getcortexapp.com"

Variables

This section is empty.

Functions

func CortexHTTPClient

func CortexHTTPClient(ctx context.Context, config *SteampipeConfig) *req.Client

Create a req http client for the Cortex API. This will set the BaseURL and Auth from config, as well as common retry settings.

func FromStructSlice

func FromStructSlice[T any](field string, child string) *transform.ColumnTransforms

Get field from the data and for each item of type T, get the nested field "child" always returns a string array

func Plugin

func Plugin(ctx context.Context) *plugin.Plugin

func TagArrayToMap

func TagArrayToMap(ctx context.Context, d *transform.TransformData) (interface{}, error)

Types

type Cortex

type Cortex struct {
	Openapi string     `yaml:"openapi"`
	Info    CortexInfo `yaml:"info"`
}

type CortexDependency

type CortexDependency struct {
	Cortex []CortexDependencyCortex `yaml:"cortex,omitempty"`
	AWS    CortexDependencyAWS      `yaml:"aws,omitempty"`
}

type CortexDependencyAWS

type CortexDependencyAWS struct {
	Tags []Tag `yaml:"tags"`
}

type CortexDependencyCortex

type CortexDependencyCortex struct {
	Tag         string `yaml:"tag"`
	Path        string `yaml:"path,omitempty"`
	Method      string `yaml:"method,omitempty"`
	Description string `yaml:"description,omitempty"`
}

type CortexDescriptorsResponse

type CortexDescriptorsResponse struct {
	Descriptors []Cortex `yaml:"descriptors"`
	Page        int      `yaml:"page"`
	TotalPages  int      `yaml:"totalPages"`
	Total       int      `yaml:"total"`
}

type CortexEntityElement

type CortexEntityElement struct {
	Name        string                        `yaml:"name"`
	Tag         string                        `yaml:"tag"`
	Description string                        `yaml:"description"`
	Type        string                        `yaml:"type"`
	Hierarchy   CortexEntityElementHierarchy  `yaml:"hierarchy"`
	Groups      []string                      `yaml:"groups"`
	Metadata    []CortexEntityElementMetadata `yaml:"metadata"`
	LastUpdated string                        `yaml:"lastUpdated"`
	Links       []CortexLink                  `yaml:"links"`
	Archived    bool                          `yaml:"isArchived"`
	Git         CortexGithub                  `yaml:"git"`
	Slack       []CortexSlackChannel          `yaml:"slackChannels"`
	Owners      CortexEntityOwners            `yaml:"owners"`
}

type CortexEntityElementHierarchy

type CortexEntityElementHierarchy struct {
	Parents []CortexTag `yaml:"parents"`
}

type CortexEntityElementMetadata

type CortexEntityElementMetadata struct {
	Key   string      `yaml:"key"`
	Value ScalarOrMap `yaml:"value"`
}

type CortexEntityOwners

type CortexEntityOwners struct {
	Teams       []CortexEntityOwnersTeam       `yaml:"teams"`
	Individuals []CortexEntityOwnersIndividual `yaml:"individuals"`
}

type CortexEntityOwnersIndividual

type CortexEntityOwnersIndividual struct {
	Email string `yaml:"email"`
}

type CortexEntityOwnersTeam

type CortexEntityOwnersTeam struct {
	Tag string `yaml:"tag"`
}

type CortexEntityResponse

type CortexEntityResponse struct {
	Entities   []CortexEntityElement `yaml:"entities"`
	Page       int                   `yaml:"page"`
	TotalPages int                   `yaml:"totalPages"`
	Total      int                   `yaml:"total"`
}

type CortexGit

type CortexGit struct {
	Github CortexGithub `yaml:"github"`
}

type CortexGithub

type CortexGithub struct {
	Repository string `yaml:"repository"`
	BasePath   string `yaml:"basepath,omitempty"`
	Alias      string `yaml:"alias,omitempty"`
}

type CortexInfo

type CortexInfo struct {
	Tag   string `yaml:"x-cortex-tag"`
	Title string `yaml:"title"`

	Description    string                 `yaml:"description,omitempty"`
	Type           string                 `yaml:"x-cortex-type,omitempty"`
	Parents        []CortexTag            `yaml:"x-cortex-parents,omitempty"`
	Groups         []string               `yaml:"x-cortex-groups,omitempty"`
	Team           CortexTeam             `yaml:"x-cortex-team,omitempty"`
	Owners         []CortexOwner          `yaml:"x-cortex-owners,omitempty"`
	Slack          CortexSlack            `yaml:"x-cortex-slack,omitempty"`
	Link           []CortexLink           `yaml:"x-cortex-link,omitempty"`
	CustomMetadata map[string]interface{} `yaml:"x-cortex-custom-metadata,omitempty"`
	Git            CortexGit              `yaml:"x-cortex-git,omitempty"`
	Oncall         CortexOncall           `yaml:"x-cortex-oncall,omitempty"`
	Issues         CortexIssues           `yaml:"x-cortex-issues,omitempty"`
	Dependency     CortexDependency       `yaml:"x-cortex-dependency,omitempty"`
}

type CortexIssues

type CortexIssues struct {
	Jira CortexIssuesJira `yaml:"jira"`
}

type CortexIssuesJira

type CortexIssuesJira struct {
	Projects []string `yaml:"projects"`
}

type CortexLevel

type CortexLevel struct {
	Name   string `yaml:"name"`
	Number int    `yaml:"number"`
}
type CortexLink struct {
	Name string `yaml:"name"`
	Type string `yaml:"type"`
	Url  string `yaml:"url"`
}

type CortexOncall

type CortexOncall struct {
	VictorOps CortexOncallVictorOps `yaml:"victorops"`
}

type CortexOncallVictorOps

type CortexOncallVictorOps struct {
	Type string `yaml:"type"`
	ID   string `yaml:"id"`
}

type CortexOwner

type CortexOwner struct {
	Type        string `yaml:"type"`
	Name        string `yaml:"name,omitempty"`
	Provider    string `yaml:"provider,omitempty"`
	Email       string `yaml:"email,omitempty"`
	Inheritance string `yaml:"inheritance,omitempty"`
	Description string `yaml:"description,omitempty"`
}

type CortexRelationshipsEdge

type CortexRelationshipsEdge struct {
	Child  string `yaml:"childTeamTag"`
	Parent string `yaml:"parentTeamTag"`
}

type CortexRelationshipsResponse

type CortexRelationshipsResponse struct {
	Edges []CortexRelationshipsEdge `yaml:"edges"`
}

type CortexRuleInfo

type CortexRuleInfo struct {
	Description   string `yaml:"description"`
	EffectiveFrom string `yaml:"effectiveFrom"`
	Identifier    string `yaml:"identifier"`
	LevelName     string `yaml:"levelName"`
	Title         string `yaml:"title"`
	Weight        int    `yaml:"weight"`

	// Not in the API response, but used to enrich the data
	LevelNumber int `yaml:"-"`
}

type CortexRuleScore

type CortexRuleScore struct {
	Expression string `yaml:"expression"`
	Identifier string `yaml:"identifier"`
	Score      int    `yaml:"score"`
}

type CortexScore

type CortexScore struct {
	Rules []*CortexRuleScore `yaml:"rules"`
}

type CortexScorecard

type CortexScorecard struct {
	Levels []*CortexScorecardLevel `yaml:"levels"`
	Rules  []*CortexRuleInfo       `yaml:"rules"`
}

type CortexScorecardLevel

type CortexScorecardLevel struct {
	Level CortexLevel `yaml:"level"`
}

type CortexScorecardResponse

type CortexScorecardResponse struct {
	Scorecard CortexScorecard `yaml:"scorecard"`
}

Response elements for the /scorecard/{tag} endpoint

type CortexScorecardScoreResponse

type CortexScorecardScoreResponse struct {
	ScorecardName string                `yaml:"scorecardName"`
	ScorecardTag  string                `yaml:"scorecardTag"`
	ServiceScores []*CortexServiceScore `yaml:"serviceScores"`
	Page          int                   `yaml:"page"`
	TotalPages    int                   `yaml:"totalPages"`
	Total         int                   `yaml:"total"`
}

Response elements for the /scorecards/{tag}/scores endpoint

type CortexScorecardScoreRow

type CortexScorecardScoreRow struct {
	ScorecardName string
	ScorecardTag  string
	LastEvaluated string
	Service       *CortexEntityElement
	RuleScore     *CortexRuleScore
	RuleInfo      *CortexRuleInfo
}

Used to represent the data we want to return in the table

func (*CortexScorecardScoreRow) IsRulePass

func (r *CortexScorecardScoreRow) IsRulePass() bool

type CortexServiceScore

type CortexServiceScore struct {
	LastEvaluated string               `yaml:"lastEvaluated"`
	Service       *CortexEntityElement `yaml:"service"`
	Score         *CortexScore         `yaml:"score"`
}

type CortexSlack

type CortexSlack struct {
	Channels []CortexSlackChannel `yaml:"channels"`
}

type CortexSlackChannel

type CortexSlackChannel struct {
	Name                 string `yaml:"name"`
	NotificationsEnabled bool   `yaml:"notificationsEnabled"`
	Description          string `yaml:"description,omitempty"`
}

type CortexTag

type CortexTag struct {
	Tag string `yaml:"tag"`
}

type CortexTeam

type CortexTeam struct {
	Groups  []CortexTeamGroup  `yaml:"groups,omitempty"`
	Members []CortexTeamMember `yaml:"members,omitempty"`
}

type CortexTeamElement

type CortexTeamElement struct {
	Tag      string                 `yaml:"teamTag"`
	Metadata map[string]interface{} `yaml:"metadata"`
	Links    []CortexLink           `yaml:"links"`
	Archived bool                   `yaml:"isArchived"`
	Slack    []CortexSlackChannel   `yaml:"slackChannels"`
	IDPGroup CortexTeamIDPGroup     `yaml:"idpGroup"`

	// Enriched data
	Children []string `yaml:"-"`
	Parents  []string `yaml:"-"`
}

type CortexTeamGroup

type CortexTeamGroup struct {
	Name     string `yaml:"name"`
	Provider string `yaml:"provider"`
}

type CortexTeamIDPGroup

type CortexTeamIDPGroup struct {
	Group    string             `yaml:"group"`
	Provider string             `yaml:"provider"`
	Members  []CortexTeamMember `yaml:"members"`
}

type CortexTeamMember

type CortexTeamMember struct {
	Name                 string `yaml:"name"`
	Email                string `yaml:"email"`
	NotificationsEnabled bool   `yaml:"notificationsEnabled"`
	Role                 string `yaml:"role,omitempty"`
}

type CortexTeamResponse

type CortexTeamResponse struct {
	Teams []CortexTeamElement `yaml:"teams"`
}

type Relationships

type Relationships struct {
	Children []string
	Parents  []string
}

type ScalarOrMap

type ScalarOrMap struct {
	Scalar interface{}
	Map    map[string]interface{}
}

func (*ScalarOrMap) UnmarshalYAML

func (s *ScalarOrMap) UnmarshalYAML(unmarshal func(interface{}) error) error

func (*ScalarOrMap) Value

func (s *ScalarOrMap) Value() interface{}

type SteampipeConfig

type SteampipeConfig struct {
	ApiKey  *string `cty:"api_key"`
	BaseURL *string `cty:"base_url"`
}

func GetConfig

func GetConfig(connection *plugin.Connection) *SteampipeConfig

func NewSteampipeConfig

func NewSteampipeConfig(token, url string) *SteampipeConfig

type Tag

type Tag struct {
	Key   string `yaml:"key"`
	Value string `yaml:"value"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL