cortex

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UserAgentPrefix is the prefix of the User-Agent header that all terraform REST calls perform.
	UserAgentPrefix = "cortex-terraform-provider"
)

Variables

View Source
var (
	ApiErrorNotFound     = errors.New("not found")
	ApiErrorUnauthorized = errors.New("unauthorized")
)
View Source
var BaseUris = map[string]string{
	"teams":                "/api/v1/teams/",
	"departments":          "/api/v1/teams/departments/",
	"scorecards":           "/api/v1/scorecards/",
	"catalog_entities":     "/api/v1/catalog/",
	"open_api":             "/api/v1/open-api",
	"resource_definitions": "/api/v1/catalog/definitions/",
}

Functions

func MapFetch

func MapFetch(m map[string]interface{}, key string, defaultValue any) any

func MapFetchToString

func MapFetchToString(m map[string]interface{}, key string) string

func Route

func Route(domain string, path string) string

func WithContext

func WithContext(ctx context.Context) func(*HttpClient) error

WithContext Specify the context for the cortex client to use.

func WithToken

func WithToken(token string) func(*HttpClient) error

WithToken Specify the API token for the cortex client to use.

func WithURL

func WithURL(baseUrl string) func(*HttpClient) error

WithURL Specify the base URL for the cortex client to connect to.

func WithVersion

func WithVersion(version string) func(*HttpClient) error

Types

type ApiError

type ApiError struct {
	Details           string `json:"details"`
	GatewayHttpStatus int    `json:"gatewayHttpStatus"`
	HttpStatus        int    `json:"httpStatus"`
	Message           string `json:"message"`
	RequestId         string `json:"requestId"`
	Type              string `json:"type"`
}

func (ApiError) String

func (err ApiError) String() string

type ArchiveTeamResponse

type ArchiveTeamResponse struct{}

type CatalogEntitiesClient

type CatalogEntitiesClient struct {
	// contains filtered or unexported fields
}

func (*CatalogEntitiesClient) Client

func (c *CatalogEntitiesClient) Client() *sling.Sling

func (*CatalogEntitiesClient) Delete

func (c *CatalogEntitiesClient) Delete(ctx context.Context, tag string) error

func (*CatalogEntitiesClient) Get

func (*CatalogEntitiesClient) GetFromDescriptor

func (c *CatalogEntitiesClient) GetFromDescriptor(ctx context.Context, tag string) (*CatalogEntityData, error)

func (*CatalogEntitiesClient) List

List retrieves a list of scorecards based on a query.

func (*CatalogEntitiesClient) Upsert

type CatalogEntitiesClientInterface

type CatalogEntitiesClientInterface interface {
	Get(ctx context.Context, tag string) (*CatalogEntity, error)
	GetFromDescriptor(ctx context.Context, tag string) (*CatalogEntityData, error)
	List(ctx context.Context, params *CatalogEntityListParams) (*CatalogEntitiesResponse, error)
	Upsert(ctx context.Context, req UpsertCatalogEntityRequest) (*CatalogEntityData, error)
	Delete(ctx context.Context, tag string) error
}

type CatalogEntitiesResponse

type CatalogEntitiesResponse struct {
	Entities []CatalogEntity `json:"entities" yaml:"entities"`
}

CatalogEntitiesResponse is the response from the GET /v1/scorecards endpoint.

type CatalogEntity

type CatalogEntity struct {
	Tag          string                 `json:"tag" yaml:"x-cortex-tag"`
	Title        string                 `json:"title" yaml:"title"`
	Description  string                 `json:"description" yaml:"description"`
	Type         string                 `json:"type" yaml:"x-cortex-type"`
	Groups       []string               `json:"groups" yaml:"x-cortex-groups"`
	Links        []CatalogEntityLink    `json:"links" yaml:"x-cortex-link"`
	Metadata     map[string]interface{} `json:"metadata" yaml:"x-cortex-custom-metadata"`
	Dependencies []string               `json:"dependencies" yaml:"x-cortex-dependency"`
	Ownership    CatalogEntityOwnership `json:"ownership" yaml:"x-cortex-owners"`
}

CatalogEntity is the nested response object that is typically returned from the catalog entities endpoints.

type CatalogEntityAlert

type CatalogEntityAlert struct {
	Type  string `json:"type" yaml:"type"`
	Tag   string `json:"tag" yaml:"tag"`
	Value string `json:"value" yaml:"value"`
}

func (*CatalogEntityAlert) Enabled added in v0.0.3

func (o *CatalogEntityAlert) Enabled() bool

type CatalogEntityApm

type CatalogEntityApm struct {
	DataDog   CatalogEntityApmDataDog   `json:"datadog,omitempty" yaml:"datadog,omitempty"`
	Dynatrace CatalogEntityApmDynatrace `json:"dynatrace,omitempty" yaml:"dynatrace,omitempty"`
	NewRelic  CatalogEntityApmNewRelic  `json:"newrelic,omitempty" yaml:"newrelic,omitempty"`
}

func (*CatalogEntityApm) Enabled added in v0.0.2

func (c *CatalogEntityApm) Enabled() bool

type CatalogEntityApmDataDog

type CatalogEntityApmDataDog struct {
	Monitors []int64 `json:"monitors" yaml:"monitors"`
}

func (*CatalogEntityApmDataDog) Enabled added in v0.0.2

func (o *CatalogEntityApmDataDog) Enabled() bool

type CatalogEntityApmDynatrace

type CatalogEntityApmDynatrace struct {
	EntityIDs          []string `json:"entityIds,omitempty" yaml:"entityIds,omitempty"`
	EntityNameMatchers []string `json:"entityNameMatchers,omitempty" yaml:"entityNameMatchers,omitempty"`
}

func (*CatalogEntityApmDynatrace) Enabled added in v0.0.2

func (o *CatalogEntityApmDynatrace) Enabled() bool

type CatalogEntityApmNewRelic

type CatalogEntityApmNewRelic struct {
	ApplicationID int64  `json:"applicationId" yaml:"applicationId"`
	Alias         string `json:"alias,omitempty" yaml:"alias,omitempty"`
}

func (*CatalogEntityApmNewRelic) Enabled added in v0.0.2

func (o *CatalogEntityApmNewRelic) Enabled() bool

type CatalogEntityBugSnag

type CatalogEntityBugSnag struct {
	Project string `json:"project" yaml:"project"`
}

func (*CatalogEntityBugSnag) Enabled added in v0.0.2

func (o *CatalogEntityBugSnag) Enabled() bool

type CatalogEntityCheckmarx

type CatalogEntityCheckmarx struct {
	Projects []CatalogEntityCheckmarxProject `json:"projects" yaml:"projects"`
}

func (*CatalogEntityCheckmarx) Enabled added in v0.0.2

func (o *CatalogEntityCheckmarx) Enabled() bool

type CatalogEntityCheckmarxProject

type CatalogEntityCheckmarxProject struct {
	ID   int64  `json:"projectId,omitempty" yaml:"projectId,omitempty"`
	Name string `json:"projectName,omitempty" yaml:"projectName,omitempty"`
}

type CatalogEntityCustomData

type CatalogEntityCustomData struct {
	ID          string      `json:"id"`
	Key         string      `json:"key"`
	Description string      `json:"description,omitempty"`
	Source      string      `json:"source"`
	Value       interface{} `json:"value"`
	DateUpdated string      `json:"dateUpdated,omitempty"`
}

type CatalogEntityCustomDataClient

type CatalogEntityCustomDataClient struct {
	// contains filtered or unexported fields
}

func (*CatalogEntityCustomDataClient) Client

func (*CatalogEntityCustomDataClient) Get

func (*CatalogEntityCustomDataClient) List

List retrieves a list of scorecards based on a query.

type CatalogEntityCustomDataClientInterface

type CatalogEntityCustomDataClientInterface interface {
	Get(ctx context.Context, entityTag string, key string) (*CatalogEntityCustomData, error)
	List(ctx context.Context, entityTag string, params *CatalogEntityCustomDataListParams) ([]CatalogEntityCustomData, error)
}

type CatalogEntityCustomDataListParams

type CatalogEntityCustomDataListParams struct{}

CatalogEntityCustomDataListParams are the query parameters for the GET /v1/catalog/:tag/custom-data endpoint.

type CatalogEntityDashboards

type CatalogEntityDashboards struct {
	Embeds []CatalogEntityDashboardsEmbed `json:"embeds,omitempty" yaml:"embeds,omitempty"`
}

func (*CatalogEntityDashboards) Enabled added in v0.0.2

func (c *CatalogEntityDashboards) Enabled() bool

type CatalogEntityDashboardsEmbed

type CatalogEntityDashboardsEmbed struct {
	Type string `json:"type" yaml:"type"` // <datadog | grafana | newrelic>
	URL  string `json:"url" yaml:"url"`
}

type CatalogEntityData

type CatalogEntityData struct {
	Title        string                    `json:"title" yaml:"title"`
	Description  string                    `json:"description,omitempty" yaml:"description,omitempty"`
	Tag          string                    `json:"x-cortex-tag" yaml:"x-cortex-tag"`
	Type         string                    `json:"x-cortex-type,omitempty" yaml:"x-cortex-type,omitempty"`
	Definition   map[string]interface{}    `json:"x-cortex-definition,omitempty" yaml:"x-cortex-definition,omitempty"`
	Owners       []CatalogEntityOwner      `json:"x-cortex-owners,omitempty" yaml:"x-cortex-owners,omitempty"`
	Groups       []string                  `json:"x-cortex-groups,omitempty" yaml:"x-cortex-groups"` // TODO: is this -groups or -service-groups? docs unclear
	Links        []CatalogEntityLink       `json:"x-cortex-link,omitempty" yaml:"x-cortex-link,omitempty"`
	Metadata     map[string]interface{}    `json:"x-cortex-custom-metadata,omitempty" yaml:"x-cortex-custom-metadata,omitempty"`
	Dependencies []CatalogEntityDependency `json:"x-cortex-dependency,omitempty" yaml:"x-cortex-dependency,omitempty"`

	// Various generic integration attributes
	Alerts         []CatalogEntityAlert        `json:"x-cortex-alerts,omitempty" yaml:"x-cortex-alerts,omitempty"`
	Apm            CatalogEntityApm            `json:"x-cortex-apm,omitempty" yaml:"x-cortex-apm,omitempty"`
	Dashboards     CatalogEntityDashboards     `json:"x-cortex-dashboards,omitempty" yaml:"x-cortex-dashboards,omitempty"`
	Git            CatalogEntityGit            `json:"x-cortex-git,omitempty" yaml:"x-cortex-git,omitempty"`
	Issues         CatalogEntityIssues         `json:"x-cortex-issues,omitempty" yaml:"x-cortex-issues,omitempty"`
	OnCall         CatalogEntityOnCall         `json:"x-cortex-oncall,omitempty" yaml:"x-cortex-oncall,omitempty"`
	SLOs           CatalogEntitySLOs           `json:"x-cortex-slos,omitempty" yaml:"x-cortex-slos,omitempty"`
	StaticAnalysis CatalogEntityStaticAnalysis `json:"x-cortex-static-analysis,omitempty" yaml:"x-cortex-static-analysis,omitempty"`

	// Integration-specific things
	BugSnag   CatalogEntityBugSnag   `json:"x-cortex-bugsnag,omitempty" yaml:"x-cortex-bugsnag,omitempty"`
	Checkmarx CatalogEntityCheckmarx `json:"x-cortex-checkmarx,omitempty" yaml:"x-cortex-checkmarx,omitempty"`
	Rollbar   CatalogEntityRollbar   `json:"x-cortex-rollbar,omitempty" yaml:"x-cortex-rollbar,omitempty"`
	Sentry    CatalogEntitySentry    `json:"x-cortex-sentry,omitempty" yaml:"x-cortex-sentry,omitempty"`
	Snyk      CatalogEntitySnyk      `json:"x-cortex-snyk,omitempty" yaml:"x-cortex-snyk,omitempty"`
}

CatalogEntityData is a struct used from YAML-based data, since its structure does not match the structure of the CatalogEntity struct in other responses. See: https://github.com/cortexapps/solutions/blob/master/examples/yaml/catalog/resource.yaml

type CatalogEntityDependency

type CatalogEntityDependency struct {
	Tag         string                 `json:"tag" yaml:"tag"`
	Method      string                 `json:"method,omitempty" yaml:"method,omitempty"`
	Path        string                 `json:"path,omitempty" yaml:"path,omitempty"`
	Description string                 `json:"description,omitempty" yaml:"description,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}

type CatalogEntityEmail

type CatalogEntityEmail struct {
	Email       string `json:"email" yaml:"email"`
	Description string `json:"description" yaml:"description"`
}

type CatalogEntityGetDescriptorParams

type CatalogEntityGetDescriptorParams struct {
	Yaml bool `url:"yaml"`
}

type CatalogEntityGit

type CatalogEntityGit struct {
	Github    CatalogEntityGitGithub      `json:"github,omitempty" yaml:"github,omitempty"`
	Gitlab    CatalogEntityGitGitlab      `json:"gitlab,omitempty" yaml:"gitlab,omitempty"`
	Azure     CatalogEntityGitAzureDevOps `json:"azure,omitempty" yaml:"azure,omitempty"`
	BitBucket CatalogEntityGitBitBucket   `json:"bitbucket,omitempty" yaml:"bitbucket,omitempty"`
}

CatalogEntityGit represents the Git metadata around a catalog entity @see https://docs.cortex.io/docs/reference/basics/entities#example-cortexyaml-for-service-entity

func (*CatalogEntityGit) Enabled added in v0.0.2

func (o *CatalogEntityGit) Enabled() bool

type CatalogEntityGitAzureDevOps

type CatalogEntityGitAzureDevOps struct {
	Project    string `json:"project" yaml:"project"`
	Repository string `json:"repository" yaml:"repository"`
	BasePath   string `json:"basepath,omitempty" yaml:"basepath,omitempty"`
}

func (*CatalogEntityGitAzureDevOps) Enabled added in v0.0.2

func (o *CatalogEntityGitAzureDevOps) Enabled() bool

type CatalogEntityGitBitBucket

type CatalogEntityGitBitBucket struct {
	Repository string `json:"repository" yaml:"repository"`
}

func (*CatalogEntityGitBitBucket) Enabled added in v0.0.2

func (o *CatalogEntityGitBitBucket) Enabled() bool

type CatalogEntityGitGithub

type CatalogEntityGitGithub struct {
	Repository string `json:"repository" yaml:"repository"`
	BasePath   string `json:"basepath,omitempty" yaml:"basepath,omitempty"`
}

func (*CatalogEntityGitGithub) Enabled added in v0.0.2

func (o *CatalogEntityGitGithub) Enabled() bool

type CatalogEntityGitGitlab

type CatalogEntityGitGitlab struct {
	Repository string `json:"repository" yaml:"repository"`
	BasePath   string `json:"basepath,omitempty" yaml:"basepath,omitempty"`
}

func (*CatalogEntityGitGitlab) Enabled added in v0.0.2

func (o *CatalogEntityGitGitlab) Enabled() bool

type CatalogEntityGroup

type CatalogEntityGroup struct {
	GroupName   string `json:"group" yaml:"groupName"`
	Description string `json:"description" yaml:"description"`
	Provider    string `json:"provider" yaml:"provider"`
}

type CatalogEntityIssues

type CatalogEntityIssues struct {
	Jira CatalogEntityIssuesJira `json:"jira,omitempty" yaml:"jira,omitempty"`
}

func (*CatalogEntityIssues) Enabled added in v0.0.2

func (c *CatalogEntityIssues) Enabled() bool

type CatalogEntityIssuesJira

type CatalogEntityIssuesJira struct {
	DefaultJQL string   `json:"defaultJql" yaml:"defaultJql"`
	Projects   []string `json:"projects,omitempty" yaml:"projects,omitempty"`
	Labels     []string `json:"labels,omitempty" yaml:"labels,omitempty"`
	Components []string `json:"components,omitempty" yaml:"components,omitempty"`
}

func (*CatalogEntityIssuesJira) Enabled added in v0.0.2

func (o *CatalogEntityIssuesJira) Enabled() bool
type CatalogEntityLink struct {
	Name string `json:"name" yaml:"name"`
	Type string `json:"type" yaml:"type"` // runbook, documentation, logs, dashboard, metrics, healthcheck
	Url  string `json:"url" yaml:"url"`
}

type CatalogEntityListParams

type CatalogEntityListParams struct {
	Groups          []string `url:"groups,omitempty"`
	Types           []string `url:"types,omitempty"`
	GitRepositories []string `url:"gitRepositories,omitempty"`
}

CatalogEntityListParams are the query parameters for the GET /v1/catalog endpoint.

type CatalogEntityOnCall

type CatalogEntityOnCall struct {
	PagerDuty CatalogEntityOnCallPagerDuty `json:"pagerduty,omitempty" yaml:"pagerduty,omitempty"`
	OpsGenie  CatalogEntityOnCallOpsGenie  `json:"opsgenie,omitempty" yaml:"opsgenie,omitempty"`
	VictorOps CatalogEntityOnCallVictorOps `json:"victorops,omitempty" yaml:"victorops,omitempty"`
}

func (*CatalogEntityOnCall) Enabled added in v0.0.2

func (c *CatalogEntityOnCall) Enabled() bool

type CatalogEntityOnCallOpsGenie

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

func (*CatalogEntityOnCallOpsGenie) Enabled added in v0.0.2

func (o *CatalogEntityOnCallOpsGenie) Enabled() bool

type CatalogEntityOnCallPagerDuty

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

func (*CatalogEntityOnCallPagerDuty) Enabled added in v0.0.2

func (o *CatalogEntityOnCallPagerDuty) Enabled() bool

type CatalogEntityOnCallVictorOps

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

func (*CatalogEntityOnCallVictorOps) Enabled added in v0.0.2

func (o *CatalogEntityOnCallVictorOps) Enabled() bool

type CatalogEntityOwner

type CatalogEntityOwner struct {
	Type                 string `json:"type" yaml:"type"`                       // group, user, slack
	Name                 string `json:"name,omitempty" yaml:"name,omitempty"`   // Must be of form <org>/<team>
	Email                string `json:"email,omitempty" yaml:"email,omitempty"` // user only
	Description          string `json:"description,omitempty" yaml:"description,omitempty"`
	Provider             string `json:"provider,omitempty" yaml:"provider,omitempty"`
	Channel              string `json:"channel,omitempty" yaml:"channel,omitempty"` // for slack, do not add # to beginning
	NotificationsEnabled bool   `json:"notificationsEnabled,omitempty" yaml:"notificationsEnabled,omitempty"`
}

type CatalogEntityOwnership

type CatalogEntityOwnership struct {
	Emails        []CatalogEntityEmail        `json:"emails"`
	Groups        []CatalogEntityGroup        `json:"groups"`
	SlackChannels []CatalogEntitySlackChannel `json:"slackChannels"`
}

type CatalogEntityParser

type CatalogEntityParser struct{}

func (*CatalogEntityParser) YamlToEntity

func (c *CatalogEntityParser) YamlToEntity(entity *CatalogEntityData, yamlEntity map[string]interface{}) (*CatalogEntityData, error)

YamlToEntity converts YAML into a CatalogEntity, from the specification.

type CatalogEntityRollbar

type CatalogEntityRollbar struct {
	Project string `json:"project" yaml:"project"`
}

func (*CatalogEntityRollbar) Enabled added in v0.0.2

func (o *CatalogEntityRollbar) Enabled() bool

type CatalogEntitySLODataDog

type CatalogEntitySLODataDog struct {
	ID string `json:"id" yaml:"id"`
}

func (*CatalogEntitySLODataDog) Enabled added in v0.0.2

func (o *CatalogEntitySLODataDog) Enabled() bool

type CatalogEntitySLODynatrace

type CatalogEntitySLODynatrace struct {
	ID string `json:"id" yaml:"id"`
}

func (*CatalogEntitySLODynatrace) Enabled added in v0.0.2

func (o *CatalogEntitySLODynatrace) Enabled() bool

type CatalogEntitySLOLightstepStream

type CatalogEntitySLOLightstepStream struct {
	StreamID string                           `json:"streamId" yaml:"streamId"`
	Targets  CatalogEntitySLOLightstepTargets `json:"targets" yaml:"targets"`
}

type CatalogEntitySLOLightstepTargetLatency

type CatalogEntitySLOLightstepTargetLatency struct {
	Percentile float64 `json:"percentile" yaml:"percentile"`
	Target     int64   `json:"target" yaml:"target"`
	SLO        float64 `json:"slo" yaml:"slo"`
}

type CatalogEntitySLOLightstepTargets

type CatalogEntitySLOLightstepTargets struct {
	Latencies []CatalogEntitySLOLightstepTargetLatency `json:"latency" yaml:"latency"`
}

type CatalogEntitySLOPrometheusQuery

type CatalogEntitySLOPrometheusQuery struct {
	ErrorQuery string  `json:"errorQuery" yaml:"errorQuery"`
	TotalQuery string  `json:"totalQuery" yaml:"totalQuery"`
	SLO        float64 `json:"slo" yaml:"slo"`
	Name       string  `json:"name,omitempty" yaml:"name,omitempty"`
	Alias      string  `json:"alias,omitempty" yaml:"alias,omitempty"`
}

type CatalogEntitySLOSignalFX

type CatalogEntitySLOSignalFX struct {
	Query     string `json:"query" yaml:"query"`
	Rollup    string `json:"rollup" yaml:"rollup"`
	Target    int64  `json:"target" yaml:"target"`
	Lookback  string `json:"lookback" yaml:"lookback"`
	Operation string `json:"operation" yaml:"operation"`
}

type CatalogEntitySLOSumoLogic

type CatalogEntitySLOSumoLogic struct {
	ID string `json:"id" yaml:"id"`
}

func (*CatalogEntitySLOSumoLogic) Enabled added in v0.0.2

func (o *CatalogEntitySLOSumoLogic) Enabled() bool

type CatalogEntitySLOs

type CatalogEntitySLOs struct {
	DataDog    []CatalogEntitySLODataDog         `json:"datadog,omitempty" yaml:"datadog,omitempty"`
	Dynatrace  []CatalogEntitySLODynatrace       `json:"dynatrace,omitempty" yaml:"dynatrace,omitempty"`
	Lightstep  []CatalogEntitySLOLightstepStream `json:"lightstep,omitempty" yaml:"lightstep,omitempty"`
	Prometheus []CatalogEntitySLOPrometheusQuery `json:"prometheus,omitempty" yaml:"prometheus,omitempty"`
	SignalFX   []CatalogEntitySLOSignalFX        `json:"signalfx,omitempty" yaml:"signalfx,omitempty"`
	SumoLogic  []CatalogEntitySLOSumoLogic       `json:"sumologic,omitempty" yaml:"sumologic,omitempty"`
}

func (*CatalogEntitySLOs) Enabled added in v0.0.2

func (c *CatalogEntitySLOs) Enabled() bool

type CatalogEntitySentry

type CatalogEntitySentry struct {
	Project string `json:"project" yaml:"project"`
}

func (*CatalogEntitySentry) Enabled added in v0.0.2

func (o *CatalogEntitySentry) Enabled() bool

type CatalogEntitySlackChannel

type CatalogEntitySlackChannel struct {
	Channel              string `json:"channel" yaml:"channel"`
	Description          string `json:"description" yaml:"description"`
	NotificationsEnabled bool   `json:"notificationsEnabled" yaml:"notificationsEnabled"`
}

type CatalogEntitySnyk

type CatalogEntitySnyk struct {
	Projects []CatalogEntitySnykProject `json:"projects,omitempty" yaml:"projects,omitempty"`
}

func (*CatalogEntitySnyk) Enabled added in v0.0.2

func (o *CatalogEntitySnyk) Enabled() bool

type CatalogEntitySnykProject

type CatalogEntitySnykProject struct {
	Organization string `json:"organizationId" yaml:"organizationId"`
	ProjectID    string `json:"projectId" yaml:"projectId"`
	Source       string `json:"source,omitempty" yaml:"source,omitempty"`
}

type CatalogEntityStaticAnalysis

type CatalogEntityStaticAnalysis struct {
	CodeCov   CatalogEntityStaticAnalysisCodeCov   `json:"codecov,omitempty" yaml:"codecov,omitempty"`
	Mend      CatalogEntityStaticAnalysisMend      `json:"mend,omitempty" yaml:"mend,omitempty"`
	SonarQube CatalogEntityStaticAnalysisSonarQube `json:"sonarqube,omitempty" yaml:"sonarqube,omitempty"`
	Veracode  CatalogEntityStaticAnalysisVeracode  `json:"veracode,omitempty" yaml:"veracode,omitempty"`
}

func (*CatalogEntityStaticAnalysis) Enabled added in v0.0.2

func (c *CatalogEntityStaticAnalysis) Enabled() bool

type CatalogEntityStaticAnalysisCodeCov

type CatalogEntityStaticAnalysisCodeCov struct {
	Repository string `json:"repo" yaml:"repo"`
	Provider   string `json:"provider" yaml:"provider"`
}

func (*CatalogEntityStaticAnalysisCodeCov) Enabled added in v0.0.2

type CatalogEntityStaticAnalysisMend

type CatalogEntityStaticAnalysisMend struct {
	ApplicationIDs []string `json:"applicationIds,omitempty" yaml:"applicationIds,omitempty"`
	ProjectIDs     []string `json:"projectIds,omitempty" yaml:"projectIds,omitempty"`
}

func (*CatalogEntityStaticAnalysisMend) Enabled added in v0.0.2

type CatalogEntityStaticAnalysisSonarQube

type CatalogEntityStaticAnalysisSonarQube struct {
	Project string `json:"project" yaml:"project"`
	Alias   string `json:"alias,omitempty" yaml:"alias,omitempty"`
}

func (*CatalogEntityStaticAnalysisSonarQube) Enabled added in v0.0.2

type CatalogEntityStaticAnalysisVeracode

type CatalogEntityStaticAnalysisVeracode struct {
	ApplicationNames []string                                     `json:"applicationNames,omitempty" yaml:"applicationNames,omitempty"`
	Sandboxes        []CatalogEntityStaticAnalysisVeracodeSandbox `json:"sandboxes,omitempty" yaml:"sandboxes,omitempty"`
}

func (*CatalogEntityStaticAnalysisVeracode) Enabled added in v0.0.2

type CatalogEntityStaticAnalysisVeracodeSandbox

type CatalogEntityStaticAnalysisVeracodeSandbox struct {
	ApplicationName string `json:"applicationName,omitempty" yaml:"applicationName,omitempty"`
	SandboxName     string `json:"sandboxName,omitempty" yaml:"sandboxName,omitempty"`
}

type CatalogEntityViolation

type CatalogEntityViolation struct {
	Description   string   `json:"description"`
	ViolationType string   `json:"violationType"`
	StartLine     int      `json:"startLine"`
	EndLine       int      `json:"endLine"`
	Paths         []string `json:"paths"`
	Pointer       string   `json:"pointer"`
	RuleLink      string   `json:"ruleLink"`
	Title         string   `json:"title"`
}

func (*CatalogEntityViolation) String

func (v *CatalogEntityViolation) String() string

type CreateDepartmentRequest

type CreateDepartmentRequest struct {
	Tag         string             `json:"departmentTag" url:"departmentTag"`
	Name        string             `json:"name"`
	Description string             `json:"description,omitempty"`
	Members     []DepartmentMember `json:"members"`
}

type CreateResourceDefinitionRequest

type CreateResourceDefinitionRequest struct {
	Type        string                 `json:"type"`
	Name        string                 `json:"name,omitempty"`
	Description string                 `json:"description,omitempty"`
	Schema      map[string]interface{} `json:"schema,omitempty"`
	Source      string                 `json:"source,omitempty"`
}

type CreateResourceDefinitionResponse

type CreateResourceDefinitionResponse struct {
	ResourceDefinition *ResourceDefinition `json:"scorecard"`
}

type CreateTeamRequest

type CreateTeamRequest struct {
	TeamTag           string             `json:"teamTag"`
	Type              string             `json:"type"`
	Metadata          TeamMetadata       `json:"metadata"`
	IsArchived        bool               `json:"isArchived,omitempty"`
	AdditionalMembers []TeamMember       `json:"additionalMembers"`
	SlackChannels     []TeamSlackChannel `json:"slackChannels"`
	Links             []TeamLink         `json:"links"`
	CortexTeam        TeamCortexManaged  `json:"cortexTeam,omitempty"`
	IdpGroup          TeamIdpGroup       `json:"idpGroup,omitempty"`
}

type DeleteCatalogEntityResponse

type DeleteCatalogEntityResponse struct{}

type DeleteDepartmentRequest

type DeleteDepartmentRequest struct {
	DepartmentTag string `json:"departmentTag" url:"departmentTag"`
}

type DeleteDepartmentResponse

type DeleteDepartmentResponse struct{}

type DeleteResourceDefinitionResponse

type DeleteResourceDefinitionResponse struct{}

type DeleteScorecardResponse

type DeleteScorecardResponse struct{}

type DeleteTeamRequest

type DeleteTeamRequest struct {
	Tag string `json:"teamTag" url:"teamTag"`
}

type DeleteTeamResponse

type DeleteTeamResponse struct{}

type Department

type Department struct {
	Tag         string             `json:"departmentTag" url:"departmentTag"`
	Name        string             `json:"name"`
	Description string             `json:"description,omitempty"`
	Members     []DepartmentMember `json:"members"`
}

Department is the response from the GET /v1/teams/departments/ endpoint.

type DepartmentGetParams

type DepartmentGetParams struct {
	DepartmentTag string `json:"departmentTag" url:"departmentTag"`
}

type DepartmentMember

type DepartmentMember struct {
	Description string `json:"description,omitempty"`
	Name        string `json:"name"`
	Email       string `json:"email"`
}

type DepartmentsClient

type DepartmentsClient struct {
	// contains filtered or unexported fields
}

func (*DepartmentsClient) Client

func (c *DepartmentsClient) Client() *sling.Sling

func (*DepartmentsClient) Create

func (*DepartmentsClient) Delete

func (c *DepartmentsClient) Delete(ctx context.Context, tag string) error

func (*DepartmentsClient) Get

func (c *DepartmentsClient) Get(ctx context.Context, tag string) (*Department, error)

func (*DepartmentsClient) Update

type DepartmentsClientInterface

type DepartmentsClientInterface interface {
	Get(ctx context.Context, tag string) (*Department, error)
	Create(ctx context.Context, req CreateDepartmentRequest) (*Department, error)
	Update(ctx context.Context, tag string, req UpdateDepartmentRequest) (*Department, error)
	Delete(ctx context.Context, tag string) error
}

type DepartmentsResponse

type DepartmentsResponse struct {
	Departments []Department `json:"department"`
}

type GetScorecardResponse

type GetScorecardResponse struct {
	Scorecard *Scorecard `json:"scorecard"`
}

GetScorecardResponse is the generic root response object for scorecards.

type HttpClient

type HttpClient struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts ...OptionDelegator) (*HttpClient, error)

NewClient initializes a new API client for Cortex.

func (*HttpClient) CatalogEntities

func (c *HttpClient) CatalogEntities() CatalogEntitiesClientInterface

func (*HttpClient) CatalogEntityCustomData

func (c *HttpClient) CatalogEntityCustomData() CatalogEntityCustomDataClientInterface

func (*HttpClient) Departments

func (c *HttpClient) Departments() DepartmentsClientInterface

func (*HttpClient) Ping

func (c *HttpClient) Ping(ctx context.Context) error

func (*HttpClient) ResourceDefinitions

func (c *HttpClient) ResourceDefinitions() ResourceDefinitionsClientInterface

func (*HttpClient) Scorecards

func (c *HttpClient) Scorecards() ScorecardsClientInterface

func (*HttpClient) Teams

func (c *HttpClient) Teams() TeamsClientInterface

type OptionDelegator

type OptionDelegator func(c *HttpClient) error

type ResourceDefinition

type ResourceDefinition struct {
	Type        string                 `json:"type" yaml:"type"`
	Name        string                 `json:"name,omitempty" yaml:"name,omitempty"`
	Description string                 `json:"description,omitempty" yaml:"description,omitempty"`
	Schema      map[string]interface{} `json:"schema,omitempty" yaml:"schema,omitempty"`
	Source      string                 `json:"source,omitempty" yaml:"source,omitempty"`
}

ResourceDefinition is the response object that is typically returned from the resource definitions endpoints.

type ResourceDefinitionListParams

type ResourceDefinitionListParams struct {
	IncludeBuiltIn bool `url:"includeBuiltIn,omitempty"`
}

ResourceDefinitionListParams are the query parameters for the GET /v1/catalog/definitions endpoint.

type ResourceDefinitionsClient

type ResourceDefinitionsClient struct {
	// contains filtered or unexported fields
}

func (*ResourceDefinitionsClient) Client

func (c *ResourceDefinitionsClient) Client() *sling.Sling

func (*ResourceDefinitionsClient) Create

func (*ResourceDefinitionsClient) Delete

func (c *ResourceDefinitionsClient) Delete(ctx context.Context, typeName string) error

func (*ResourceDefinitionsClient) Get

func (*ResourceDefinitionsClient) List

List retrieves a list of resource definitions based on a query.

func (*ResourceDefinitionsClient) Update

type ResourceDefinitionsResponse

type ResourceDefinitionsResponse struct {
	ResourceDefinitions []ResourceDefinition `json:"definitions"`
}

ResourceDefinitionsResponse is the response from the GET /v1/catalog/definitions endpoint.

type Scorecard

type Scorecard struct {
	Tag         string                  `json:"tag" yaml:"tag"`
	Name        string                  `json:"name,omitempty" yaml:"name,omitempty"`
	Description string                  `json:"description,omitempty" yaml:"description,omitempty"`
	IsDraft     bool                    `json:"is_draft" yaml:"is_draft"`
	Rules       []ScorecardRule         `json:"rules" yaml:"rules"`
	Levels      []ScorecardLevelSummary `json:"levels" yaml:"levels"`
	Filter      ScorecardFilter         `json:"filter" yaml:"filter"`
	Evaluation  ScorecardEvaluation     `json:"evaluation" yaml:"evaluation"`
}

Scorecard is the nested response object that is typically returned from the scorecards endpoints.

type ScorecardEvaluation

type ScorecardEvaluation struct {
	Window int `json:"window" yaml:"window"`
}

type ScorecardFilter

type ScorecardFilter struct {
	Category string `json:"category" yaml:"category"`
	Query    string `json:"query" yaml:"query"`
}

type ScorecardLadder

type ScorecardLadder struct {
	Levels []ScorecardLevel `json:"levels" yaml:"levels"`
}

type ScorecardLevel

type ScorecardLevel struct {
	Name        string `json:"name" yaml:"name"`
	Rank        int    `json:"rank" yaml:"rank"`
	Color       string `json:"color" yaml:"color"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

type ScorecardLevelSummary

type ScorecardLevelSummary struct {
	Name string `json:"name" yaml:"name"`
	Rank int64  `json:"rank" yaml:"rank"`
}

type ScorecardListParams

type ScorecardListParams struct {
}

ScorecardListParams are the query parameters for the GET /v1/scorecards endpoint.

type ScorecardRule

type ScorecardRule struct {
	Title          string `json:"title" yaml:"title"`
	Description    string `json:"description" yaml:"description"`
	Expression     string `json:"expression" yaml:"expression"`
	FailureMessage string `json:"failure_message" yaml:"failureMessage"`
	LevelName      string `json:"level_name" yaml:"levelName"`
	Weight         int    `json:"weight" yaml:"weight"`
}

type ScorecardsClient

type ScorecardsClient struct {
	// contains filtered or unexported fields
}

func (*ScorecardsClient) Client

func (c *ScorecardsClient) Client() *sling.Sling

func (*ScorecardsClient) Delete

func (c *ScorecardsClient) Delete(ctx context.Context, tag string) error

func (*ScorecardsClient) Get

func (c *ScorecardsClient) Get(ctx context.Context, tag string) (*Scorecard, error)

func (*ScorecardsClient) GetFromDescriptor

func (c *ScorecardsClient) GetFromDescriptor(ctx context.Context, tag string) (*Scorecard, error)

func (*ScorecardsClient) List

List retrieves a list of scorecards based on a query.

func (*ScorecardsClient) Upsert

type ScorecardsClientInterface

type ScorecardsClientInterface interface {
	Get(ctx context.Context, tag string) (*Scorecard, error)
	List(ctx context.Context, params *ScorecardListParams) (*ScorecardsResponse, error)
	Upsert(ctx context.Context, req UpsertScorecardRequest) (*Scorecard, error)
	Delete(ctx context.Context, tag string) error
}

type ScorecardsResponse

type ScorecardsResponse struct {
	Scorecards []Scorecard `json:"scorecards"`
}

ScorecardsResponse is the response from the GET /v1/scorecards endpoint.

type Team

type Team struct {
	AdditionalMembers []TeamMember       `json:"additionalMembers,omitempty"`
	IsArchived        bool               `json:"isArchived,omitempty"`
	Metadata          TeamMetadata       `json:"metadata"`
	SlackChannels     []TeamSlackChannel `json:"slackChannels,omitempty"`
	Links             []TeamLink         `json:"links,omitempty"`
	TeamTag           string             `json:"teamTag"`
}

Team is the response from the GET /v1/teams/{team_tag} endpoint.

type TeamCortexManaged

type TeamCortexManaged struct {
	Members []TeamMember `json:"members"`
}

type TeamIdpGroup

type TeamIdpGroup struct {
	Group    string               `json:"group"`
	Members  []TeamIdpGroupMember `json:"members"`
	Provider string               `json:"provider"`
}

type TeamIdpGroupMember

type TeamIdpGroupMember struct {
	Email string `json:"email,omitempty"`
	ID    string `json:"id"`
	Name  string `json:"name"`
}
type TeamLink struct {
	Name        string `json:"name"`
	Type        string `json:"type,omitempty"`
	Url         string `json:"url"`
	Description string `json:"description,omitempty"`
}

type TeamListParams

type TeamListParams struct {
}

TeamListParams are the query parameters for the GET /v1/teams endpoint.

type TeamMember

type TeamMember struct {
	Description string `json:"description,omitempty"`
	Name        string `json:"name"`
	Email       string `json:"email"`
}

type TeamMetadata

type TeamMetadata struct {
	Description string `json:"description,omitempty"`
	Name        string `json:"name"`
	Summary     string `json:"summary,omitempty"`
}

type TeamSlackChannel

type TeamSlackChannel struct {
	Name                 string `json:"name"`
	NotificationsEnabled bool   `json:"notificationsEnabled"`
}

type TeamsClient

type TeamsClient struct {
	// contains filtered or unexported fields
}

func (*TeamsClient) Archive

func (c *TeamsClient) Archive(ctx context.Context, tag string) error

func (*TeamsClient) Client

func (c *TeamsClient) Client() *sling.Sling

func (*TeamsClient) Create

func (c *TeamsClient) Create(ctx context.Context, req CreateTeamRequest) (*Team, error)

func (*TeamsClient) Delete

func (c *TeamsClient) Delete(ctx context.Context, tag string) error

func (*TeamsClient) Get

func (c *TeamsClient) Get(ctx context.Context, tag string) (*Team, error)

func (*TeamsClient) List

func (c *TeamsClient) List(ctx context.Context, params *TeamListParams) (*TeamsResponse, error)

List retrieves a list of teams based on a team query.

func (*TeamsClient) Unarchive

func (c *TeamsClient) Unarchive(ctx context.Context, tag string) error

func (*TeamsClient) Update

func (c *TeamsClient) Update(ctx context.Context, tag string, req UpdateTeamRequest) (*Team, error)

type TeamsClientInterface

type TeamsClientInterface interface {
	Get(ctx context.Context, tag string) (*Team, error)
	List(ctx context.Context, params *TeamListParams) (*TeamsResponse, error)
	Create(ctx context.Context, createReq CreateTeamRequest) (*Team, error)
	Update(ctx context.Context, tag string, updateReq UpdateTeamRequest) (*Team, error)
	Delete(ctx context.Context, tag string) error
	Archive(ctx context.Context, tag string) error
	Unarchive(ctx context.Context, tag string) error
}

type TeamsResponse

type TeamsResponse struct {
	Teams []Team `json:"teams"`
}

TeamsResponse is the response from the GET /v1/teams endpoint.

type UnarchiveTeamResponse

type UnarchiveTeamResponse struct{}

type UpdateDepartmentRequest

type UpdateDepartmentRequest struct {
	Name        string             `json:"name"`
	Description string             `json:"description,omitempty"`
	Members     []DepartmentMember `json:"members"`
}

type UpdateResourceDefinitionRequest

type UpdateResourceDefinitionRequest struct {
	Name        string                 `json:"name,omitempty"`
	Description string                 `json:"description,omitempty"`
	Schema      map[string]interface{} `json:"schema,omitempty"`
}

type UpdateTeamRequest

type UpdateTeamRequest struct {
	Metadata          TeamMetadata       `json:"metadata"`
	Links             []TeamLink         `json:"links"`
	SlackChannels     []TeamSlackChannel `json:"slackChannels"`
	AdditionalMembers []TeamMember       `json:"additionalMembers"`
}

type UpsertCatalogEntityRequest

type UpsertCatalogEntityRequest struct {
	Info    CatalogEntityData `json:"info"`
	OpenApi string            `json:"openapi"`
}

type UpsertCatalogEntityResponse

type UpsertCatalogEntityResponse struct {
	Ok         bool                     `json:"ok"`
	Violations []CatalogEntityViolation `json:"violations"`
}

type UpsertScorecardRequest

type UpsertScorecardRequest struct {
	Tag         string          `yaml:"tag"`
	Name        string          `yaml:"name"`
	Description string          `yaml:"description"`
	IsDraft     bool            `yaml:"is_draft"`
	Rules       []ScorecardRule `yaml:"rules"`
	Ladder      ScorecardLadder `yaml:"ladder"`
}

UpsertScorecardRequest is the request object that is a struct representation of the Scorecard descriptor YAML file. We do this to allow for easier creation of scorecards in Go or Terraform, rather than having to pass through a YAML file or string, and figure out how to tell Terraform to "compare" that data.

type UpsertScorecardResponse

type UpsertScorecardResponse struct {
	Scorecard *Scorecard `json:"scorecard"`
}

Jump to

Keyboard shortcuts

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