cmd

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultProfileConfigName = ".direktiv.profile.yaml"
	DefaultProfileConfigPath = ".config/direktiv/"
)
View Source
const ToolName = "direktivctl"

Variables

View Source
var (
	UrlPrefix   string
	UrlPrefixV2 string
)
View Source
var RootCmd = &cobra.Command{
	Use: ToolName,
}

Functions

func AddAuthHeaders

func AddAuthHeaders(req *http.Request)

func AddSSEAuthHeaders

func AddSSEAuthHeaders(client *sse.Client)

func Fail

func Fail(cmd *cobra.Command, s string, x ...interface{})

func FormatLogEntry added in v0.8.4

func FormatLogEntry(data map[string]interface{}) string

func GetAuth

func GetAuth() string

func GetConfigFilePath added in v0.8.0

func GetConfigFilePath() (string, error)

func GetLogs added in v0.8.0

func GetLogs(cmd *cobra.Command, instance string, query string) (urlOutput string)

func GetLogsSSE added in v0.8.4

func GetLogsSSE(ctx context.Context, printToConsole LoggerFunc, urlsse string) error

func GetLogsV2 added in v0.8.4

func GetLogsV2(ctx context.Context, printToConsole LoggerFunc, urlGet string) error

func GetMaxSize added in v0.8.0

func GetMaxSize() int64

func GetNamespace

func GetNamespace() string

func GetProjectFileLocation added in v0.8.0

func GetProjectFileLocation() string

func GetRelativePath

func GetRelativePath(configPath, targpath string) (string, error)

func GetTLSConfig

func GetTLSConfig() *tls.Config

func InitConfiguration added in v0.8.0

func InitConfiguration(cmd *cobra.Command, args []string)

func InitConfigurationAndProject added in v0.8.0

func InitConfigurationAndProject(cmd *cobra.Command, args []string)

func InitWD added in v0.8.0

func InitWD() error

func LoadProfileConfig added in v0.8.0

func LoadProfileConfig() error

func ProjectFolder

func ProjectFolder() (string, error)

func SafeLoadFile

func SafeLoadFile(filePath string) (*bytes.Buffer, error)

func SafeLoadStdIn

func SafeLoadStdIn() (*bytes.Buffer, error)

Types

type Configuration added in v0.8.0

type Configuration struct {
	project.Config `mapstructure:",squash"  yaml:",inline"`
	Profiles       map[string]ProfileConfig `mapstructure:"profiles" yaml:"profiles,flow"`
}
var (
	Config   Configuration
	Globbers []glob.Glob
)

type FilterQueryInstance added in v0.8.0

type FilterQueryInstance struct {
	Typ     string
	Filter  string
	Payload []string
}

func (FilterQueryInstance) Query added in v0.8.0

func (fq FilterQueryInstance) Query() string

type InstanceResponse added in v0.8.0

type InstanceResponse struct {
	Namespace string `json:"namespace"`
	Instance  struct {
		CreatedAt    time.Time `json:"createdAt"`
		UpdatedAt    time.Time `json:"updatedAt"`
		ID           string    `json:"id"`
		As           string    `json:"as"`
		Status       string    `json:"status"`
		ErrorCode    string    `json:"errorCode"`
		ErrorMessage string    `json:"errorMessage"`
	} `json:"instance"`
	InvokedBy string   `json:"invokedBy"`
	Flow      []string `json:"flow"`
	Workflow  struct {
		Path   string `json:"path"`
		Name   string `json:"name"`
		Parent string `json:"parent"`
	} `json:"workflow"`
}

type LogResponse added in v0.8.0

type LogResponse struct {
	PageInfo struct {
		TotalCount int `json:"total"`
		Limit      int `json:"limit"`
		Offset     int `json:"offset"`
	} `json:"pageInfo"`
	Results []struct {
		T     time.Time         `json:"t"`
		Msg   string            `json:"msg"`
		Level string            `json:"level"`
		Tags  map[string]string `json:"tags"`
	} `json:"results"`
	Namespace string `json:"namespace"`
	Instance  string `json:"instance"`
}

type LoggerFunc added in v0.8.4

type LoggerFunc func(msg string)

type ProfileConfig

type ProfileConfig struct {
	Addr      string `mapstructure:"addr"      yaml:"addr"`
	Namespace string `mapstructure:"namespace" yaml:"namespace"`
	Auth      string `mapstructure:"auth"      yaml:"auth"`
	MaxSize   int64  `mapstructure:"max-size"  yaml:"max-size"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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