opslevel

package
v2.15.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package opslevel implements helpers for working with the OpsLevel API.

Index

Constants

View Source
const (
	// BeginnerLevel is the index for the Beginner level in OpsLevel.
	BeginnerLevel = 0
	// BronzeLevel is the index for Bronze level in  OpsLevel.
	BronzeLevel = 1
	// SilverLevel is the index for Silver level in  OpsLevel.
	SilverLevel = 2
	// SilverUpcomingLevel is the index for the Silver (Upcoming) level in OpsLevel.
	SilverUpcomingLevel = 3
	// GoldLevel is the index for Gold level in  OpsLevel.
	GoldLevel = 4
	// PlatinumLevel is the index for Platinum level in  OpsLevel.
	PlatinumLevel = 5

	// DevelopmentLifecycle if the index for the Development lifecycle in OpsLevel.
	DevelopmentLifecycle = 1
	// PrivateBetaLifecycle if the index for the Private Beta lifecycle in OpsLevel.
	PrivateBetaLifecycle = 2
	// PublicBetaLifecycle if the index for the Public Beta lifecycle in OpsLevel.
	PublicBetaLifecycle = 3
	// PublicLifecycle if the index for the Public lifecycle in OpsLevel.
	PublicLifecycle = 4
	// OpsLifecycle if the index for the Ops lifecycle in OpsLevel.
	OpsLifecycle = 5
	// EndOfLifeLifecycle if the index for the Endo-of-Life lifecycle in OpsLevel.
	EndOfLifeLifecycle = 6
)

Initializes constants for OpsLevel level and lifecycle indexes.

Variables

DefaultLifecycleToLevelMap maps lifecycle index to level index. We want to keep this at the index level in case names or other attributes change.

Functions

func ShouldBeSkipped

func ShouldBeSkipped(tags []opslevel.Tag) bool

ShouldBeSkipped checks if a service has gating disabled. If it does, it should be skipped.

Types

type Client

type Client struct {
	*opslevel.Client // Internal opslevel client.

	// LifecycleToLevelMap maps lifecycle index to level index.
	LifecycleToLevelMap LifecycleToLevelMap
}

Client is a opslevel client

func NewClient

func NewClient(lifecycleToLevelMap LifecycleToLevelMap) (*Client, error)

NewClient returns a new opslevel client configured with the token we expect to exist in the environment.

func (Client) GetExpectedLevel

func (c Client) GetExpectedLevel(service *opslevel.Service, levels []opslevel.Level) (string, error)

GetExpectedLevel retrieves the expected maturity level of the service

func (Client) IsCompliant

func (c Client) IsCompliant(service *opslevel.Service, sm *opslevel.ServiceMaturity) (bool, error)

IsCompliant checks if the service falls within the expected maturity level. This check is primarily controlled by the LifecycleToLevel map

type LifecycleToLevelMap

type LifecycleToLevelMap map[int]int

LifecycleToLevelMap maps between Lifecycle and expected service maturity level

Jump to

Keyboard shortcuts

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