utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Home dir is used for reading OCI config file and SSH keys

Index

Constants

This section is empty.

Variables

View Source
var ColumnFmt = color.New(color.FgYellow).SprintfFunc()
View Source
var HeaderFmt = color.New(color.FgCyan, color.Underline).SprintfFunc()
View Source
var Italic = color.New(color.Italic)
View Source
var Logger *slog.Logger

Functions

func CheckError

func CheckError(err error)

func ConfigFileInit

func ConfigFileInit()

Create config file if it doesn't exist

func ConfigFileRead

func ConfigFileRead()

Load config file into Viper config Note: Only compartment is persisted in config file

func GenerateID added in v1.4.0

func GenerateID(length int) string

func HomeDir

func HomeDir() string

func LookUpTenancyID

func LookUpTenancyID(tenancyName string) (string, error)

func OciConfig

func OciConfig() common.ConfigurationProvider

func OciProfile

func OciProfile() string

func PrintTenancyMap

func PrintTenancyMap()

func SetCompartmentConfig

func SetCompartmentConfig(FlagCompartment *pflag.Flag, compartments map[string]string, tenancyName string)

func SetTenancyConfig

func SetTenancyConfig(FlagTenancyId *pflag.Flag, ociConfig common.ConfigurationProvider)

func WriteCompartmentToFile

func WriteCompartmentToFile(compartment string, compartments map[string]string)

Reset config file and wite compartment to file Note: Since we only care about persisting compartment to file, we will not use Viper to write the config, which would persist all Viper configuration

Types

type Config

type Config struct {
	Compartment string `yaml:"compartment"`
}

type OciTenancyEnvironment

type OciTenancyEnvironment struct {
	Environment  string `yaml:"environment"`
	Tenancy      string `yaml:"tenancy"`
	TenancyId    string `yaml:"tenancy_id"`
	Realm        string `yaml:"realm"`
	Compartments string `yaml:"compartments"`
	Regions      string `yaml:"regions"`
}

Jump to

Keyboard shortcuts

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