Documentation
¶
Overview ¶
Package opslevel implements helpers for working with the OpsLevel API.
Index ¶
Constants ¶
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 ¶
var DefaultLifecycleToLevelMap = LifecycleToLevelMap{ DevelopmentLifecycle: BronzeLevel, PrivateBetaLifecycle: SilverLevel, PublicBetaLifecycle: SilverLevel, PublicLifecycle: SilverLevel, OpsLifecycle: SilverLevel, EndOfLifeLifecycle: BeginnerLevel, }
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 ¶
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 ¶
IsCompliant checks if the service falls within the expected maturity level. This check is primarily controlled by the LifecycleToLevel map
type LifecycleToLevelMap ¶
LifecycleToLevelMap maps between Lifecycle and expected service maturity level