config

package
v0.0.0-...-10013d6 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyRootCmdConfigDir     = "configdir"
	TenantConfigFile        = "tenant-config.yaml"
	Auth0DeployConfigFile   = "a0deploy-config.json"
	ClientConfigFile        = "client-config.yaml"
	FlagRootCmdConfigDir    = "config-dir"
	DescRootCmdConfigDir    = "directory of spsauth0 configuration files."
	DefaultRootCmdConfigDir = "~/.spsauth0"

	KeyCmdTenantName = "tenant_name"
)

Variables

This section is empty.

Functions

func GetClientListNames

func GetClientListNames(clients ClientList) []string

func GetSupportedClientTypes

func GetSupportedClientTypes() []string

func InitConfigDir

func InitConfigDir(cfgDir string) (string, error)

InitConfigDir ensures the spsauth0 config dir has been created

func InitConfigDirWithViper

func InitConfigDirWithViper() (string, error)

InitConfigDirWithViper ensures the spsauth0 config dir has been created and uses viper to load the path to the spsauth0 dir

func SyncGetConfigDir

func SyncGetConfigDir() string

SyncGetConfigDir gets the config dir synchronously, if loaded.

func SyncInitConfigDir

func SyncInitConfigDir(cfgDir string)

SyncInitConfigDir initializes the config directory for spsauth0

func SyncInitConfigDirErr

func SyncInitConfigDirErr() error

SyncInitConfigDirErr reports if there was an error initializing the config dir, or if initialization has not yet occurred.

Types

type A0deployConfig

type A0deployConfig struct {
	// contains filtered or unexported fields
}

TenantConfig represents auth0 Tenants that spsauth0 stores

func LoadA0DeployConfigWithViper

func LoadA0DeployConfigWithViper() (*A0deployConfig, error)

LoadTenantConfigWithViper sets the path to aws cred config using the viper config (i.e. --configdir) and then ensures the AWS config file exists and loads it.

func LoadA0deployConfig

func LoadA0deployConfig(cfgFile string) (*A0deployConfig, error)

func (*A0deployConfig) GetA0deployConfig

func (a0 *A0deployConfig) GetA0deployConfig(tenantName string) *Auth0Config

GetTenantConfig returns the tenantConfig for the specified name or nil if the tenant does not exist or config has not been loaded.

func (*A0deployConfig) SetA0deployConfig

func (a0 *A0deployConfig) SetA0deployConfig(profileName string, profile *Auth0Config)

SetAWSProfile sets the profile in the local cache and the store

type API

type API struct {
	Name     string
	Audience string
}

type Auth0Config

type Auth0Config struct {
	Auth0Domain       string `json:"AUTH0_DOMAIN"`
	Auth0ClientSecret string `json:"AUTH0_CLIENT_SECRET"`
	Auth0ClientId     string `json:"AUTH0_CLIENT_ID"`
}

type Client

type Client struct {
	ClientId     string
	ClientSecret string
	ClientName   string
	ClientType   string
	TenantName   string
	Token        string
	Audience     string
}

Rename this vales to not have the type client in them.

type ClientConfig

type ClientConfig struct {
	// contains filtered or unexported fields
}

func LoadClientConfig

func LoadClientConfig(cfgFile string) (*ClientConfig, error)

LoadClientConfig ensures the tenant config file exists and then loads it. Once loaded, it can be set and written to multiple times within the process. If changes are made directly to the file, though, they will likely be overwritten while the process is running

func LoadClientConfigWithViper

func LoadClientConfigWithViper() (*ClientConfig, error)

LoadClientConfigWithViper sets the path to aws cred config using the viper config (i.e. --configdir) and then ensures the AWS config file exists and loads it.

func (*ClientConfig) GetClientConfig

func (c *ClientConfig) GetClientConfig(clientName string) *Client

GetTenantConfig returns the tenantConfig for the specified name or nil if the tenant does not exist or config has not been loaded.

func (*ClientConfig) GetClientList

func (c *ClientConfig) GetClientList(tenantName string) *ClientList

GetTenantProfileList returns a list of all AWSProfilesItems in the config store, or nil if there was an error loading the config.

func (*ClientConfig) SaveClientConfig

func (c *ClientConfig) SaveClientConfig() error

SaveTenantConfig writes the config back to disk, capturing any profile and session changes

func (*ClientConfig) SetClient

func (c *ClientConfig) SetClient(client *Client)

SetAWSProfile sets the profile in the local cache and the store

type ClientList

type ClientList []*Client

type Tenant

type Tenant struct {
	Tenant TenantProfile
}

Remove this struct. No reason to have this be a wrapper around TenantProfile

type TenantConfig

type TenantConfig struct {
	// contains filtered or unexported fields
}

TenantConfig represents auth0 Tenants that spsauth0 stores

func LoadTenantConfig

func LoadTenantConfig(cfgFile string) (*TenantConfig, error)

LoadTenantConfig ensures the tenant config file exists and then loads it. Once loaded, it can be set and written to multiple times within the process. If changes are made directly to the file, though, they will likely be overwritten while the process is running

func LoadTenantConfigWithViper

func LoadTenantConfigWithViper() (*TenantConfig, error)

LoadTenantConfigWithViper sets the path to aws cred config using the viper config (i.e. --configdir) and then ensures the AWS config file exists and loads it.

func (*TenantConfig) GetTenantAPINames

func (a *TenantConfig) GetTenantAPINames(tenantAPIs []API) []string

func (*TenantConfig) GetTenantConfig

func (t *TenantConfig) GetTenantConfig(tenantName string) *Tenant

GetTenantConfig returns the tenantConfig for the specified name or nil if the tenant does not exist or config has not been loaded.

func (*TenantConfig) GetTenantListNames

func (a *TenantConfig) GetTenantListNames() []string

func (*TenantConfig) GetTenantProfileList

func (a *TenantConfig) GetTenantProfileList() *TenantProfileList

GetTenantProfileList returns a list of all AWSProfilesItems in the config store, or nil if there was an error loading the config.

func (*TenantConfig) SaveTenantConfig

func (a *TenantConfig) SaveTenantConfig() error

SaveTenantConfig writes the config back to disk, capturing any profile and session changes

func (*TenantConfig) SetTenant

func (a *TenantConfig) SetTenant(profileName string, profile *Tenant)

SetAWSProfile sets the profile in the local cache and the store

type TenantProfile

type TenantProfile struct {
	Name          string
	Domain        string
	APIs          []API
	DefaultClient *Client
}

type TenantProfileList

type TenantProfileList []*TenantProfile

Jump to

Keyboard shortcuts

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