cmd

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package cmd is the cobra cli implementation for the core server

Index

Constants

View Source
const (
	TableOutput = "table"
	JSONOutput  = "json"
)

Variables

View Source
var (
	// ErrTokenRequired is returned when no authentication token is provided
	ErrTokenRequired = errors.New("ACCESS_TOKEN not set")

	// ErrInvalidRole is returned when an invalid role is provided for a member
	ErrInvalidRole = errors.New("invalid role, only member and admin are allowed")

	// ErrInvalidInviteStatus is returned when an invalid status is provided for an invite
	ErrInvalidInviteStatus = errors.New("invalid status, only sent, required, accepted, expired are allowed")

	// ErrUnsupportedProvider is returned when an invalid provider is specified during login
	ErrUnsupportedProvider = errors.New("invalid provider, only Github and Google are supported")

	// ErrNotFound is returned when a resource is not found
	ErrNotFound = errors.New("resource not found")

	// ErrSessionNotFound is returned when a session is not found
	ErrSessionNotFound = errors.New("session not found")
)
View Source
var (
	OutputFormat string
	InputFile    string
	Config       *koanf.Koanf
)
View Source
var (
	// RootHost contains the root url for the API
	RootHost string
	// GraphAPIHost contains the url for the graph api
	GraphAPIHost string
)
View Source
var RootCmd = &cobra.Command{
	Use:   appName,
	Short: "the openlane cli",
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		initConfiguration(cmd)
	},
}

RootCmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GetInviteStatusEnum

func GetInviteStatusEnum(status string) (enums.InviteStatus, error)

GetInviteStatusEnum returns the invitation status if valid, otherwise returns an error

func GetKeyring

func GetKeyring() (keyring.Keyring, error)

GetKeyring will return the already loaded keyring so that we don't prompt users for passwords multiple times

func GetRoleEnum

func GetRoleEnum(role string) (enums.Role, error)

GetRoleEnum returns the Role if valid, otherwise returns an error

func GetTokenFromKeyring

func GetTokenFromKeyring(ctx context.Context) (*oauth2.Token, string, error)

GetTokenFromKeyring will return the oauth token from the keyring if the token is expired, but the refresh token is still valid, the token will be refreshed

func JSONPrint

func JSONPrint(s []byte) error

JSONPrint prints a JSON formatted string with color

func ParseBytes

func ParseBytes(v []byte) (map[string]interface{}, error)

ParseBytes parses buffered bytes into a map

func ParseJSON

func ParseJSON(v string) (map[string]interface{}, error)

ParseJSON parses a JSON formatted string into a map

func SetupClient

func SetupClient(ctx context.Context) (*openlaneclient.OpenlaneClient, error)

SetupClient will setup the client without the Authorization header this is used for endpoints that do not require authentication, e.g. `v1/login`

func SetupClientWithAuth

func SetupClientWithAuth(ctx context.Context) (*openlaneclient.OpenlaneClient, error)

SetupClientWithAuth will setup the openlane client with the the bearer token passed in the Authorization header and the session cookie passed in the Cookie header. If the token is expired, it will be refreshed. The token and session will be stored in the keyring for future requests

func StoreAuthCookies

func StoreAuthCookies(client *openlaneclient.OpenlaneClient)

StoreAuthCookies gets the auth cookies from the cookie jar if they exist and stores them in the keychain for future requests

func StoreSession

func StoreSession(session string) error

StoreSession in local keyring

func StoreSessionCookies

func StoreSessionCookies(client *openlaneclient.OpenlaneClient)

StoreSessionCookies gets the session cookie from the cookie jar and stores it in the keychain for future requests

func StoreToken

func StoreToken(token *oauth2.Token) error

StoreToken in local keyring

Types

type RequiredFieldMissingError

type RequiredFieldMissingError struct {
	// Field contains the required field that was missing from the input
	Field string
}

RequiredFieldMissingError is returned when a field is required but not provided

func NewRequiredFieldMissingError

func NewRequiredFieldMissingError(f string) *RequiredFieldMissingError

NewRequiredFieldMissingError returns an error for a missing required field

func (*RequiredFieldMissingError) Error

func (e *RequiredFieldMissingError) Error() string

Error returns the RequiredFieldMissingError in string format

Directories

Path Synopsis
Package apitokens is our cobra cli for api token endpoints
Package apitokens is our cobra cli for api token endpoints
Package contact is our cobra cli for contact endpoints
Package contact is our cobra cli for contact endpoints
Package contacthistory is our cobra cli for contactHistory endpoints
Package contacthistory is our cobra cli for contactHistory endpoints
Package documentdatahistory is our cobra cli for documentDataHistory endpoints
Package documentdatahistory is our cobra cli for documentDataHistory endpoints
Package entitlementhistory is our cobra cli for entitlementHistory endpoints
Package entitlementhistory is our cobra cli for entitlementHistory endpoints
Package entitlementplan is our cobra cli for entitlement plan endpoints
Package entitlementplan is our cobra cli for entitlement plan endpoints
Package entitlementplanfeaturehistory is our cobra cli for entitlementPlanFeatureHistory endpoints
Package entitlementplanfeaturehistory is our cobra cli for entitlementPlanFeatureHistory endpoints
Package entitlementplanfeatures is our cobra cli for plan feature endpoints
Package entitlementplanfeatures is our cobra cli for plan feature endpoints
Package entitlementplanhistory is our cobra cli for entitlementPlanHistory endpoints
Package entitlementplanhistory is our cobra cli for entitlementPlanHistory endpoints
Package entitlement is our cobra cli for entitlement endpoints
Package entitlement is our cobra cli for entitlement endpoints
Package entity is our cobra cli for entity endpoints
Package entity is our cobra cli for entity endpoints
Package entityhistory is our cobra cli for entityHistory endpoints
Package entityhistory is our cobra cli for entityHistory endpoints
Package entitytype is our cobra cli for entity type endpoints
Package entitytype is our cobra cli for entity type endpoints
Package entitytypehistory is our cobra cli for entityTypeHistory endpoints
Package entitytypehistory is our cobra cli for entityTypeHistory endpoints
Package eventhistory is our cobra cli for eventHistory endpoints
Package eventhistory is our cobra cli for eventHistory endpoints
Package featurehistory is our cobra cli for featureHistory endpoints
Package featurehistory is our cobra cli for featureHistory endpoints
Package feature is our cobra cli for feature endpoints
Package feature is our cobra cli for feature endpoints
Package file is our cobra cli for file endpoints
Package file is our cobra cli for file endpoints
Package filehistory is our cobra cli for fileHistory endpoints
Package filehistory is our cobra cli for fileHistory endpoints
Package group is our cobra cli for group endpoints
Package group is our cobra cli for group endpoints
Package grouphistory is our cobra cli for groupHistory endpoints
Package grouphistory is our cobra cli for groupHistory endpoints
Package groupmembers is our cobra cli for group member endpoints
Package groupmembers is our cobra cli for group member endpoints
Package groupmembershiphistory is our cobra cli for groupMembershipHistory endpoints
Package groupmembershiphistory is our cobra cli for groupMembershipHistory endpoints
Package groupsetting provides commands for managing group settings
Package groupsetting provides commands for managing group settings
Package groupsettinghistory is our cobra cli for groupSettingHistory endpoints
Package groupsettinghistory is our cobra cli for groupSettingHistory endpoints
Package hushhistory is our cobra cli for hushHistory endpoints
Package hushhistory is our cobra cli for hushHistory endpoints
Package integrationhistory is our cobra cli for integrationHistory endpoints
Package integrationhistory is our cobra cli for integrationHistory endpoints
Package internalpolicy is our cobra cli for internalPolicy endpoints
Package internalpolicy is our cobra cli for internalPolicy endpoints
Package internalpolicyhistory is our cobra cli for internalPolicyHistory endpoints
Package internalpolicyhistory is our cobra cli for internalPolicyHistory endpoints
Package invite creates invitation emails + tokens for external users to join an organization
Package invite creates invitation emails + tokens for external users to join an organization
Package login is our cobra cli for authentication endpoints
Package login is our cobra cli for authentication endpoints
Package oauthproviderhistory is our cobra cli for oauthProviderHistory endpoints
Package oauthproviderhistory is our cobra cli for oauthProviderHistory endpoints
Package org is our cobra cli for organization endpoints
Package org is our cobra cli for organization endpoints
Package organizationhistory is our cobra cli for organizationHistory endpoints
Package organizationhistory is our cobra cli for organizationHistory endpoints
Package orgsetting provides commands for managing organization settings
Package orgsetting provides commands for managing organization settings
Package organizationsettinghistory is our cobra cli for organizationSettingHistory endpoints
Package organizationsettinghistory is our cobra cli for organizationSettingHistory endpoints
Package orgmembers is our cobra cli for org member endpoints
Package orgmembers is our cobra cli for org member endpoints
Package orgmembershiphistory is our cobra cli for orgMembershipHistory endpoints
Package orgmembershiphistory is our cobra cli for orgMembershipHistory endpoints
Package tokens is our cobra cli for token endpoints
Package tokens is our cobra cli for token endpoints
Package procedure is our cobra cli for procedure endpoints
Package procedure is our cobra cli for procedure endpoints
Package procedurehistory is our cobra cli for procedureHistory endpoints
Package procedurehistory is our cobra cli for procedureHistory endpoints
Package program is our cobra cli for program endpoints
Package program is our cobra cli for program endpoints
Package programhistory is our cobra cli for programHistory endpoints
Package programhistory is our cobra cli for programHistory endpoints
Package register allows user registration
Package register allows user registration
Package reset allows user password reset
Package reset allows user password reset
Package search is our cobra cli for search endpoint
Package search is our cobra cli for search endpoint
Package subscribers is our cobra cli for subscriber endpoints
Package subscribers is our cobra cli for subscriber endpoints
Package switchcontext provides a basic interface to switch between organization contexts
Package switchcontext provides a basic interface to switch between organization contexts
Package task is our cobra cli for task endpoints
Package task is our cobra cli for task endpoints
Package taskhistory is our cobra cli for taskHistory endpoints
Package taskhistory is our cobra cli for taskHistory endpoints
Package templatehistory is our cobra cli for templateHistory endpoints
Package templatehistory is our cobra cli for templateHistory endpoints
Package user is our cobra cli for user endpoints
Package user is our cobra cli for user endpoints
Package userhistory is our cobra cli for userHistory endpoints
Package userhistory is our cobra cli for userHistory endpoints
Package usersetting is our cobra cli for user setting endpoints
Package usersetting is our cobra cli for user setting endpoints
Package usersettinghistory is our cobra cli for userSettingHistory endpoints
Package usersettinghistory is our cobra cli for userSettingHistory endpoints
Package version contains the version information for the CLI
Package version contains the version information for the CLI
Package webhookhistory is our cobra cli for webhookHistory endpoints
Package webhookhistory is our cobra cli for webhookHistory endpoints

Jump to

Keyboard shortcuts

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