Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ConfigurationPriorityRules = []Layer{ {constants.ArgToken, "", "", fmt.Sprintf("Global Flags (--%s)", constants.ArgToken)}, {constants.EnvToken, constants.EnvUsername, constants.EnvPassword, fmt.Sprintf("Environment Variables (%s, %s, %s)", constants.EnvToken, constants.EnvUsername, constants.EnvPassword)}, {constants.CfgToken, constants.CfgUsername, constants.CfgPassword, fmt.Sprintf("Config file settings (%s, %s, %s)", constants.CfgToken, constants.CfgUsername, constants.CfgPassword)}, }
Functions ¶
Types ¶
type Client ¶
type Client struct { CloudClient *cloudv6.APIClient AuthClient *sdkgoauth.APIClient CertManagerClient *certmanager.APIClient PostgresClient *postgres.APIClient MongoClient *mongo.APIClient DataplatformClient *dataplatform.APIClient RegistryClient *registry.APIClient DnsClient *dns.APIClient // contains filtered or unexported fields }
func Get ¶
Get a client and possibly fail. Uses viper to get the credentials and API URL. The returned client is guaranteed to have working credentials Order: Explicit flags ( e.g. --token ) Environment Variables ( e.g. IONOS_TOKEN ) Config File ( e.g. userdata.token )
func Must ¶
Must gets the client obj or fatally dies You can provide some optional custom error handlers as params. The err is sent to each error handler in order. The default error handler is die.Die which exits with code 1 and violently terminates the program
func NewClient ¶ added in v6.7.0
NewClient bypasses the singleton check, not recommended for normal use.
func NewClientFromCfgData ¶ added in v6.7.0
func (*Client) IsTokenAuth ¶ added in v6.7.0
IsTokenAuth returns true if a token is being used for authentication. Otherwise, username & password were used.
type Layer ¶ added in v6.7.0
type Layer struct { TokenKey string UsernameKey string PasswordKey string Description string // You can optionally pass a string to describe to the user what this layer is and how to set its values }
Layer represents an authentication layer. E.g., flags, env vars, config file. A client can use one of these layers to authenticate against CloudAPI, each layer has priority over layers that are defined after it. the Token has priority over username & password pairs of the same authentication layer.