credentials

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreApiKeyVar   = "CRE_API_KEY"
	AuthTypeApiKey = "api-key"
	AuthTypeBearer = "bearer"
	ConfigDir      = ".cre"
	ConfigFile     = "cre.yaml"

	// DeploymentAccessStatusFullAccess indicates the organization has full deployment access
	DeploymentAccessStatusFullAccess = "FULL_ACCESS"
)

Variables

View Source
var UngatedOrgRequiredMsg = "" /* 166-byte string literal not displayed */

UngatedOrgRequiredMsg is the error message shown when an organization does not have ungated access.

Functions

func SaveCredentials

func SaveCredentials(tokenSet *CreLoginTokenSet) error

Types

type CreLoginTokenSet

type CreLoginTokenSet struct {
	AccessToken  string `json:"access_token"  yaml:"AccessToken"` // #nosec G117 -- matches OAuth token response field
	IDToken      string `json:"id_token"      yaml:"IDToken"`
	RefreshToken string `json:"refresh_token" yaml:"RefreshToken"` // #nosec G117 -- matches OAuth token response field
	ExpiresIn    int    `json:"expires_in"    yaml:"ExpiresIn"`
	TokenType    string `json:"token_type"    yaml:"TokenType"`
}

type Credentials

type Credentials struct {
	Tokens      *CreLoginTokenSet `yaml:"tokens"`
	APIKey      string            `yaml:"api_key"` // #nosec G117 -- credential stored in secure config file
	AuthType    string            `yaml:"auth_type"`
	IsValidated bool              `yaml:"-"`
	OrgID       string            `yaml:"-"`
	// contains filtered or unexported fields
}

func New

func New(logger *zerolog.Logger) (*Credentials, error)

func (*Credentials) CheckIsUngatedOrganization added in v1.0.2

func (c *Credentials) CheckIsUngatedOrganization() error

CheckIsUngatedOrganization verifies that the organization associated with the credentials has FULL_ACCESS status (is not gated). This check is required for certain operations like workflow key linking.

func (*Credentials) GetDeploymentAccessStatus added in v1.2.0

func (c *Credentials) GetDeploymentAccessStatus() (*DeploymentAccess, error)

GetDeploymentAccessStatus returns the deployment access status for the organization. This can be used to check and display whether the user has deployment access.

func (*Credentials) GetOrgID added in v1.8.0

func (c *Credentials) GetOrgID() (string, error)

GetOrgID returns the organization ID from the access token.

type DeploymentAccess added in v1.2.0

type DeploymentAccess struct {
	HasAccess bool   // Whether the organization has deployment access
	Status    string // The raw status value (e.g., "FULL_ACCESS", "PENDING", etc.)
}

DeploymentAccess holds information about an organization's deployment access status

Jump to

Keyboard shortcuts

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