config

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var URLAliases = map[string]string{
	"production":  "https://api.openshift.com",
	"staging":     "https://api.stage.openshift.com",
	"integration": "https://api.integration.openshift.com",
}

URLAliases allows the value of the `--env` option to map to the various API URLs.

Functions

func Location

func Location() (path string, err error)

Location returns the location of the configuration file.

func Remove

func Remove() error

Remove removes the configuration file.

func Save

func Save(cfg *Config) error

Save saves the given configuration to the configuration file.

Types

type Config

type Config struct {
	AccessToken  string   `json:"access_token,omitempty"`
	ClientID     string   `json:"client_id,omitempty"`
	ClientSecret string   `json:"client_secret,omitempty"`
	Insecure     bool     `json:"insecure,omitempty"`
	RefreshToken string   `json:"refresh_token,omitempty"`
	Scopes       []string `json:"scopes,omitempty"`
	TokenURL     string   `json:"token_url,omitempty"`
	URL          string   `json:"url,omitempty"`
}

Config is the type used to store the configuration of the client.

func Load

func Load() (cfg *Config, err error)

Load loads the configuration from the configuration file. If the configuration file doesn't exist it will return an empty configuration object.

func (*Config) Armed

func (c *Config) Armed() (armed bool, err error)

Armed checks if the configuration contains either credentials or tokens that haven't expired, so that it can be used to perform authenticated requests.

func (*Config) Connection

func (c *Config) Connection() (connection *sdk.Connection, err error)

Connection creates a connection using this configuration.

func (*Config) GetData

func (c *Config) GetData(key string) (value string, err error)

Jump to

Keyboard shortcuts

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